Merge pull request #5109 from betavs/hotfix/color-picker-change

fix(color-picker): change event only shows old color value
pull/4628/merge
Tuğçe Küçükoğlu 2024-02-01 12:03:31 +03:00 committed by GitHub
commit 47a5020c11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 8 deletions

View File

@ -96,8 +96,7 @@ export default {
this.selfUpdate = true;
this.updateColorHandle();
this.updateInput();
this.updateModel();
this.$emit('change', { event: event, value: this.modelValue });
this.updateModel(event);
},
pickHue(event) {
let top = this.hueView.getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0);
@ -111,28 +110,32 @@ export default {
this.selfUpdate = true;
this.updateColorSelector();
this.updateHue();
this.updateModel();
this.updateModel(event);
this.updateInput();
this.$emit('change', { event: event, value: this.modelValue });
},
updateModel() {
updateModel(event) {
let value = this.modelValue;
switch (this.format) {
case 'hex':
this.$emit('update:modelValue', this.HSBtoHEX(this.hsbValue));
value = this.HSBtoHEX(this.hsbValue);
break;
case 'rgb':
this.$emit('update:modelValue', this.HSBtoRGB(this.hsbValue));
value = this.HSBtoRGB(this.hsbValue);
break;
case 'hsb':
this.$emit('update:modelValue', this.hsbValue);
value = this.hsbValue;
break;
default:
//NoOp
break;
}
this.$emit('update:modelValue', value);
this.$emit('change', { event, value });
},
updateColorSelector() {
if (this.colorSelector) {