Commit f2d087145e4076c1182d783f99c9031a01fd484c

Authored by 2hu
Committed by GitHub
1 parent 75abb3bb

Fix race condition for changing "currentValue"

One real world example, when using the `Slider` component as the audio play progress bar, the `value/currentValue` could be updated by listening the `timeupdate` event of the audio element or by user dragging interaction, but user interaction should have higher priority over the `timeupdate` event.
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
src/components/slider/slider.vue
@@ -169,7 +169,7 @@ @@ -169,7 +169,7 @@
169 watch: { 169 watch: {
170 value (val) { 170 value (val) {
171 val = this.checkLimits(Array.isArray(val) ? val : [val]); 171 val = this.checkLimits(Array.isArray(val) ? val : [val]);
172 - if (val[0] !== this.currentValue[0] || val[1] !== this.currentValue[1]) { 172 + if (!this.dragging && (val[0] !== this.currentValue[0] || val[1] !== this.currentValue[1])) {
173 this.currentValue = val; 173 this.currentValue = val;
174 } 174 }
175 }, 175 },