fix Slider not emit on-change event when click bar at first time

This commit is contained in:
miomio-xiao 2018-04-04 09:54:30 +08:00
parent d4c9b17b0f
commit 42ab875dd0

View file

@ -151,7 +151,7 @@
startX: 0, startX: 0,
currentX: 0, currentX: 0,
startPos: 0, startPos: 0,
oldValue: val, oldValue: [...val],
valueIndex: { valueIndex: {
min: 0, min: 0,
max: 1, max: 1,
@ -328,9 +328,9 @@
else newPos = this.checkLimits([this.minPosition, newPos])[1]; else newPos = this.checkLimits([this.minPosition, newPos])[1];
const modulus = this.handleDecimal(newPos,this.step); const modulus = this.handleDecimal(newPos,this.step);
const value = [...this.currentValue]; const value = this.currentValue;
value[index] = newPos - modulus; value[index] = newPos - modulus;
this.currentValue = value; this.currentValue = [...value];
if (!this.dragging) { if (!this.dragging) {
if (this.currentValue[index] !== this.oldValue[index]) { if (this.currentValue[index] !== this.oldValue[index]) {