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 | 151 | startX: 0, |
| 152 | 152 | currentX: 0, |
| 153 | 153 | startPos: 0, |
| 154 | - oldValue: val, | |
| 154 | + oldValue: [...val], | |
| 155 | 155 | valueIndex: { |
| 156 | 156 | min: 0, |
| 157 | 157 | max: 1, |
| ... | ... | @@ -328,9 +328,9 @@ |
| 328 | 328 | else newPos = this.checkLimits([this.minPosition, newPos])[1]; |
| 329 | 329 | |
| 330 | 330 | const modulus = this.handleDecimal(newPos,this.step); |
| 331 | - const value = [...this.currentValue]; | |
| 331 | + const value = this.currentValue; | |
| 332 | 332 | value[index] = newPos - modulus; |
| 333 | - this.currentValue = value; | |
| 333 | + this.currentValue = [...value]; | |
| 334 | 334 | |
| 335 | 335 | if (!this.dragging) { |
| 336 | 336 | if (this.currentValue[index] !== this.oldValue[index]) { | ... | ... |