[bugfix] Slider: should not emit change event when value not changed (#4087)
This commit is contained in:
+6
-2
@@ -96,14 +96,18 @@ export default createComponent({
|
||||
const total = this.vertical ? rect.height : rect.width;
|
||||
const value = (delta / total) * this.range + this.min;
|
||||
|
||||
this.startValue = this.value;
|
||||
this.updateValue(value, true);
|
||||
},
|
||||
|
||||
updateValue(value, end) {
|
||||
value = this.format(value);
|
||||
this.$emit('input', value);
|
||||
|
||||
if (end) {
|
||||
if (value !== this.value) {
|
||||
this.$emit('input', value);
|
||||
}
|
||||
|
||||
if (end && value !== this.startValue) {
|
||||
this.$emit('change', value);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user