mirror of https://github.com/ElemeFE/element
ColorPicker: replace watch hue with computed
parent
94e6288286
commit
cc7a461db5
|
@ -32,8 +32,15 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
hueValue() {
|
||||||
|
const hue = this.color.get('hue');
|
||||||
|
return hue;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
'color._hue'() {
|
hueValue() {
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,15 +28,19 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
// while watch hue and value with computed to call update once
|
|
||||||
colorValue() {
|
colorValue() {
|
||||||
const hue = this.color.get('hue');
|
const hue = this.color.get('hue');
|
||||||
const value = this.color.get('value');
|
const value = this.color.get('value');
|
||||||
this.update();
|
|
||||||
return { hue, value };
|
return { hue, value };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
colorValue() {
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
update() {
|
update() {
|
||||||
const saturation = this.color.get('saturation');
|
const saturation = this.color.get('saturation');
|
||||||
|
|
Loading…
Reference in New Issue