fix(slider): keep slide move evenly (#3876)

fix #2085, fix #2717
This commit is contained in:
rex 2020-12-18 15:10:44 +08:00 committed by GitHub
parent eaf513bf2f
commit c088113714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,7 @@ VantComponent({
this.dragStatus = 'draging'; this.dragStatus = 'draging';
getRect(this, '.van-slider').then((rect) => { getRect(this, '.van-slider').then((rect) => {
const diff = (this.deltaX / rect.width) * this.data.max; const diff = (this.deltaX / rect.width) * this.getRange();
this.newValue = this.startValue + diff; this.newValue = this.startValue + diff;
this.updateValue(this.newValue, false, true); this.updateValue(this.newValue, false, true);
}); });