Commit 42ab875dd09b2b95d57034179ea7da38cd06b6c3
1 parent
d4c9b17b
fix Slider not emit on-change event when click bar at first time
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
src/components/slider/slider.vue
@@ -151,7 +151,7 @@ | @@ -151,7 +151,7 @@ | ||
151 | startX: 0, | 151 | startX: 0, |
152 | currentX: 0, | 152 | currentX: 0, |
153 | startPos: 0, | 153 | startPos: 0, |
154 | - oldValue: val, | 154 | + oldValue: [...val], |
155 | valueIndex: { | 155 | valueIndex: { |
156 | min: 0, | 156 | min: 0, |
157 | max: 1, | 157 | max: 1, |
@@ -328,9 +328,9 @@ | @@ -328,9 +328,9 @@ | ||
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 | ||
335 | if (!this.dragging) { | 335 | if (!this.dragging) { |
336 | if (this.currentValue[index] !== this.oldValue[index]) { | 336 | if (this.currentValue[index] !== this.oldValue[index]) { |