From d4c9b17b0f6b6053e8448a601555d1cdadce8f53 Mon Sep 17 00:00:00 2001 From: miomio-xiao Date: Mon, 2 Apr 2018 16:47:40 +0800 Subject: [PATCH] fix Slider组件第一次click的时候不触发on-change --- src/components/slider/slider.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/slider/slider.vue b/src/components/slider/slider.vue index ec91eeb..c911f52 100644 --- a/src/components/slider/slider.vue +++ b/src/components/slider/slider.vue @@ -326,11 +326,12 @@ const index = type === 'min' ? 0 : 1; if (type === 'min') newPos = this.checkLimits([newPos, this.maxPosition])[0]; else newPos = this.checkLimits([this.minPosition, newPos])[1]; - + const modulus = this.handleDecimal(newPos,this.step); - const value = this.currentValue; + const value = [...this.currentValue]; value[index] = newPos - modulus; - this.currentValue = [...value]; + this.currentValue = value; + if (!this.dragging) { if (this.currentValue[index] !== this.oldValue[index]) { this.emitChange(); -- libgit2 0.21.4