Merge pull request #3291 from miomio-xiao/2.0

fix Slider not emit on-change event when click bar at first time
This commit is contained in:
Aresn 2018-04-04 10:20:05 +08:00 committed by GitHub
commit 0e6b84f379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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