diff --git a/components/fields/components/color.vue b/components/fields/components/color.vue index 4330fee..ef6fc1a 100755 --- a/components/fields/components/color.vue +++ b/components/fields/components/color.vue @@ -2,11 +2,11 @@
-
+
- +
@@ -29,20 +29,28 @@ }, name: 'field-color', data: () => ({ - model: { - hex: '#ffffff' - } + hex: '' }), + props: { + color: { + type: String, + default: '#FFFFFF' + } + }, methods: { updateValue (color) { - this.model.hex = color.hex - this.$emit('input', color.hex) + this.hex = color + this.$emit('input', color) } }, watch: { value (color) { - this.model.hex = color + this.hex = color } + }, + created () { + this.hex = this.color + this.updateValue(this.color) } }