From c1eba287d190c428370e3b635fe058a72257ef1b Mon Sep 17 00:00:00 2001 From: Mix Date: Fri, 8 Dec 2017 05:30:40 -0300 Subject: [PATCH] Update color.vue --- components/fields/components/color.vue | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) 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) } }