[youzan/vant-weapp][Bug Report] 【Enhancement】slider值范围较大时滑起来摩擦力很大

2024-05-15 7 views

回答

2

设置slider max时值较小时又太容易滑了

9

我是设置0-100然后自己映射数据

9

也遇到了这个问题,如果和0~100映射的话,写起来也怪怪的

3

同遇到这个问题,我这边写的时时间条、不太好转化为0-100

6

这个问题 可以到slider组件的js文件里找到这个方法

onTouchMove: function (event) {
            var _this = this;
            if (this.data.disabled)
                return;
            if (this.dragStatus === 'start') {
                this.$emit('drag-start');
            }
            this.touchMove(event);
            this.dragStatus = 'draging';
            this.getRect('.van-slider').then(function (rect) {
                var diff = (_this.deltaX / rect.width) * 100;
                _this.newValue = _this.startValue + diff;
                _this.updateValue(_this.newValue, false, true);
            });
        },

把上面的diff 后面乘的100 换成 _this.data.max 即可