From f2d087145e4076c1182d783f99c9031a01fd484c Mon Sep 17 00:00:00 2001 From: 2hu Date: Sun, 15 Apr 2018 20:32:02 +0800 Subject: [PATCH] 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. --- src/components/slider/slider.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/slider/slider.vue b/src/components/slider/slider.vue index 37034df0..e2a7ab03 100644 --- a/src/components/slider/slider.vue +++ b/src/components/slider/slider.vue @@ -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; } },