From a5e2c120fdba788e328cd9c3c5afdbed885d4217 Mon Sep 17 00:00:00 2001 From: frank <404784102@qq.com> Date: Tue, 15 Dec 2020 16:15:24 +0800 Subject: [PATCH] Update index.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 自定义等分时,滑动需按照自定义等分的距离触发步进 --- lib/slider/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/slider/index.js b/lib/slider/index.js index 9016c975..812e8d82 100644 --- a/lib/slider/index.js +++ b/lib/slider/index.js @@ -57,6 +57,10 @@ component_1.VantComponent({ this.dragStatus = 'draging'; utils_1.getRect.call(this, '.van-slider').then(function (rect) { var diff = (_this.deltaX / rect.width) * 100; + // 当设置最大值时(及自定义等分),滑动触发步进需按照等分后的滑动距离触发 + if (this.data.max) { + diff = diff * this.data.max / 100 + } _this.newValue = _this.startValue + diff; _this.updateValue(_this.newValue, false, true); });