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.
This commit is contained in:
2hu 2018-04-15 20:32:02 +08:00 committed by GitHub
parent 75abb3bb28
commit f2d087145e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -169,7 +169,7 @@
watch: {
value (val) {
val = this.checkLimits(Array.isArray(val) ? val : [val]);
if (val[0] !== this.currentValue[0] || val[1] !== this.currentValue[1]) {
if (!this.dragging && (val[0] !== this.currentValue[0] || val[1] !== this.currentValue[1])) {
this.currentValue = val;
}
},