[bugfix] Slider: should not emit change event when value not changed (#4087)

This commit is contained in:
neverland
2019-08-10 22:12:10 +08:00
committed by GitHub
parent 7e4795fa24
commit 135531cd03
4 changed files with 28 additions and 4 deletions
+6 -2
View File
@@ -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);
}
},