Commit 0e6b84f3796ad1239caea3b52895ffbecb1fb510

Authored by Aresn
Committed by GitHub
2 parents 15342275 42ab875d

Merge pull request #3291 from miomio-xiao/2.0

fix Slider not emit on-change event when click bar at first time
Showing 1 changed file with 3 additions and 2 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,
... ... @@ -326,11 +326,12 @@
326 326 const index = type === 'min' ? 0 : 1;
327 327 if (type === 'min') newPos = this.checkLimits([newPos, this.maxPosition])[0];
328 328 else newPos = this.checkLimits([this.minPosition, newPos])[1];
329   -
  329 +
330 330 const modulus = this.handleDecimal(newPos,this.step);
331 331 const value = this.currentValue;
332 332 value[index] = newPos - modulus;
333 333 this.currentValue = [...value];
  334 +
334 335 if (!this.dragging) {
335 336 if (this.currentValue[index] !== this.oldValue[index]) {
336 337 this.emitChange();
... ...