mirror of https://github.com/ElemeFE/element
Slider: fix drag bug
parent
c80db9ca8a
commit
932d6bdb6f
|
@ -136,7 +136,12 @@
|
|||
},
|
||||
|
||||
setPosition(newPos) {
|
||||
if (newPos >= 0 && (newPos <= 100)) {
|
||||
if (newPos < 0) {
|
||||
newPos = 0;
|
||||
} else if (newPos > 100) {
|
||||
newPos = 100;
|
||||
}
|
||||
|
||||
const lengthPerStep = 100 / ((this.max - this.min) / this.step);
|
||||
const steps = Math.round(newPos / lengthPerStep);
|
||||
let value = steps * lengthPerStep * (this.max - this.min) * 0.01 + this.min;
|
||||
|
@ -151,7 +156,6 @@
|
|||
this.oldValue = this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onSliderClick(event) {
|
||||
|
|
Loading…
Reference in New Issue