Commit d4c9b17b0f6b6053e8448a601555d1cdadce8f53
1 parent
15342275
fix Slider组件第一次click的时候不触发on-change
Showing
1 changed file
with
4 additions
and
3 deletions
Show diff stats
src/components/slider/slider.vue
@@ -326,11 +326,12 @@ | @@ -326,11 +326,12 @@ | ||
326 | const index = type === 'min' ? 0 : 1; | 326 | const index = type === 'min' ? 0 : 1; |
327 | if (type === 'min') newPos = this.checkLimits([newPos, this.maxPosition])[0]; | 327 | if (type === 'min') newPos = this.checkLimits([newPos, this.maxPosition])[0]; |
328 | else newPos = this.checkLimits([this.minPosition, newPos])[1]; | 328 | else newPos = this.checkLimits([this.minPosition, newPos])[1]; |
329 | - | 329 | + |
330 | const modulus = this.handleDecimal(newPos,this.step); | 330 | const modulus = this.handleDecimal(newPos,this.step); |
331 | - const value = this.currentValue; | 331 | + const value = [...this.currentValue]; |
332 | value[index] = newPos - modulus; | 332 | value[index] = newPos - modulus; |
333 | - this.currentValue = [...value]; | 333 | + this.currentValue = value; |
334 | + | ||
334 | if (!this.dragging) { | 335 | if (!this.dragging) { |
335 | if (this.currentValue[index] !== this.oldValue[index]) { | 336 | if (this.currentValue[index] !== this.oldValue[index]) { |
336 | this.emitChange(); | 337 | this.emitChange(); |