From 2a021c03c1c77beff81cf16fa272162ae54ba8ab Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <470459819@qq.com> Date: Mon, 5 Dec 2022 13:27:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/laydate.js | 2 +- src/modules/slider.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 0af5d9b8..d3e283ee 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -1500,7 +1500,7 @@ if(options.range && options.type !== 'time'){ start = start || (that.rangeLinked ? that.startDate : options.dateTime); end = end || that.endDate; - isOut = that.newDate(start).getTime() > that.newDate(end).getTime(); + isOut = !that.endState || that.newDate(start).getTime() > that.newDate(end).getTime(); //如果不在有效日期内,直接禁用按钮,否则比较开始和结束日期 (that.limit({ diff --git a/src/modules/slider.js b/src/modules/slider.js index 541b8a80..a5d819ef 100644 --- a/src/modules/slider.js +++ b/src/modules/slider.js @@ -298,7 +298,7 @@ layui.define('jquery', function(exports){ }; //动态赋值 - if(setValue === 'set') return change(value, i, 'done'); + if(setValue === 'set') return change(value - options.min, i, 'done'); //滑块滑动 sliderAct.find('.' + SLIDER_WRAP_BTN).each(function(index){ From 926fd2cbffc064c1e06f85ecf0ad1d6adba91717 Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <470459819@qq.com> Date: Mon, 5 Dec 2022 13:44:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dslider=E7=9A=84setValue?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=BC=A0=E5=85=A5=E4=B8=8D=E5=9C=A8=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E5=86=85=E7=9A=84=E5=80=BC=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E7=9A=84=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/slider.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/slider.js b/src/modules/slider.js index a5d819ef..3dbaf586 100644 --- a/src/modules/slider.js +++ b/src/modules/slider.js @@ -32,6 +32,8 @@ layui.define('jquery', function(exports){ return { setValue: function(value, index){ // 设置值 + value = value > options.max ? options.max : value; + value = value < options.min ? options.min : value; options.value = value; return that.slide('set', value, index || 0); } @@ -235,6 +237,7 @@ layui.define('jquery', function(exports){ offsetValue = Math.round(offsetValue) * step }; offsetValue = offsetValue > 100 ? 100: offsetValue; + offsetValue = offsetValue < 0 ? 0: offsetValue; sliderWrap.eq(index).css((options.type === 'vertical' ?'bottom':'left'), offsetValue + '%'); var firLeft = valueTo(sliderWrap[0].offsetLeft) ,secLeft = options.range ? valueTo(sliderWrap[1].offsetLeft) : 0;