mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-08-29 12:23:21 +08:00
fix(Slier): fix slide step with max been set
This commit is contained in:
commit
555f2e9561
@ -57,6 +57,10 @@ component_1.VantComponent({
|
|||||||
this.dragStatus = 'draging';
|
this.dragStatus = 'draging';
|
||||||
utils_1.getRect.call(this, '.van-slider').then(function (rect) {
|
utils_1.getRect.call(this, '.van-slider').then(function (rect) {
|
||||||
var diff = (_this.deltaX / rect.width) * 100;
|
var diff = (_this.deltaX / rect.width) * 100;
|
||||||
|
// 当设置最大值时(及自定义等分),滑动触发步进需按照等分后的滑动距离触发
|
||||||
|
if (this.data.max) {
|
||||||
|
diff = diff * this.data.max / 100
|
||||||
|
}
|
||||||
_this.newValue = _this.startValue + diff;
|
_this.newValue = _this.startValue + diff;
|
||||||
_this.updateValue(_this.newValue, false, true);
|
_this.updateValue(_this.newValue, false, true);
|
||||||
});
|
});
|
||||||
|
@ -62,7 +62,7 @@ VantComponent({
|
|||||||
this.dragStatus = 'draging';
|
this.dragStatus = 'draging';
|
||||||
|
|
||||||
getRect.call(this, '.van-slider').then((rect) => {
|
getRect.call(this, '.van-slider').then((rect) => {
|
||||||
const diff = (this.deltaX / rect.width) * 100;
|
const diff = (this.deltaX / rect.width) * this.data.max;
|
||||||
this.newValue = this.startValue + diff;
|
this.newValue = this.startValue + diff;
|
||||||
this.updateValue(this.newValue, false, true);
|
this.updateValue(this.newValue, false, true);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user