ColorPicker: replace watch hue with computed

pull/5289/head
kingwl 2017-06-05 23:21:01 +08:00 committed by 杨奕
parent 94e6288286
commit cc7a461db5
2 changed files with 14 additions and 3 deletions

View File

@ -32,8 +32,15 @@
};
},
computed: {
hueValue() {
const hue = this.color.get('hue');
return hue;
}
},
watch: {
'color._hue'() {
hueValue() {
this.update();
}
},

View File

@ -28,15 +28,19 @@
},
computed: {
// while watch hue and value with computed to call update once
colorValue() {
const hue = this.color.get('hue');
const value = this.color.get('value');
this.update();
return { hue, value };
}
},
watch: {
colorValue() {
this.update();
}
},
methods: {
update() {
const saturation = this.color.get('saturation');