From ba0910eb2610146cdd0eb4544153d23a7c05d90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 17 Jul 2022 12:31:02 +0800 Subject: [PATCH 1/3] =?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 --- examples/slider.html | 8 ++++++++ src/modules/dropdown.js | 2 +- src/modules/layer.js | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/slider.html b/examples/slider.html index 31051709..2c5a9571 100644 --- a/examples/slider.html +++ b/examples/slider.html @@ -16,6 +16,8 @@ body{padding:100px 0;}
+
+
@@ -50,6 +52,12 @@ layui.use('slider', function(){ }); sliderInst.setValue(30); + + + slider.render({ + elem: '#slideTest2', + type: 'vertical' + }); }); diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index 0cccc385..9bf76a8b 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -495,7 +495,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){ //是否超出底部屏幕 if(rect.bottom > _WIN.height()){ - elemPanel.eq(0).css('margin-top', -(rect.bottom - _WIN.height())); + elemPanel.eq(0).css('margin-top', -(rect.bottom - _WIN.height() + 5)); }; }).on('mouseleave', ELEM_LI_PAR, function(e){ var othis = $(this) diff --git a/src/modules/layer.js b/src/modules/layer.js index edcee5b0..8e59e25e 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -850,7 +850,7 @@ layer.style = function(index, options, limit){ } layero.css(options); - btnHeight = layero.find('.'+doms[6]).outerHeight(); + btnHeight = layero.find('.'+doms[6]).outerHeight() || 0; if(type === ready.type[2]){ layero.find('iframe').css({ From 37bc2311ca9adceaf26287f2ca2760a13016c22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Mon, 18 Jul 2022 00:00:49 +0800 Subject: [PATCH 2/3] update --- src/modules/element.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/element.js b/src/modules/element.js index 7fb8011a..c5c77f94 100644 --- a/src/modules/element.js +++ b/src/modules/element.js @@ -131,9 +131,9 @@ layui.define('jquery', function(exports){ ,filter = parents.attr('lay-filter'); if(li.hasClass(THIS)){ - if (li.next()[0] && li.next()[0].tagName === 'LI'){ + if (li.next()[0] && li.next().is('li')){ call.tabClick.call(li.next()[0], null, index + 1); - } else if (li.prev()[0] && li.prev()[0].tagName === 'LI'){ + } else if (li.prev()[0] && li.prev().is('li')){ call.tabClick.call(li.prev()[0], null, index - 1); } } From 397cf80f7cc72d99b8fe5ea842ada78341b788c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Mon, 18 Jul 2022 00:01:27 +0800 Subject: [PATCH 3/3] update --- examples/laydate.html | 8 +++++++- src/modules/laydate.js | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/examples/laydate.html b/examples/laydate.html index 01857051..a7e2e8e7 100644 --- a/examples/laydate.html +++ b/examples/laydate.html @@ -257,13 +257,19 @@ layui.use('laydate', function(laydate){ } }); - //同时绑定多个 + // 同时绑定多个 + laydate.render({ + elem: '.test-item', + trigger: 'click' + }); + /* lay('.test-item').each(function(){ laydate.render({ elem: this ,trigger: 'click' }); }); + */ //自定义重要日 var ins555 = laydate.render({ diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 28629e8d..72f2ec8a 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -74,6 +74,17 @@ var that = this; that.index = ++laydate.index; that.config = lay.extend({}, that.config, laydate.config, options); + + // 若 elem 非唯一,则拆分为多个实例 + var elem = lay(options.elem || that.config.elem); + if(elem.length > 1){ + layui.each(elem, function(){ + laydate.render(lay.extend({}, that.config, { + elem: this + })); + }); + return that; + } //初始化 id 参数 options = that.config; @@ -1292,7 +1303,7 @@ ); }; - //获得指定日期时间对象时间戳 + // 获得指定日期时间对象的毫秒数 Class.prototype.getDateTime = function(obj){ return this.newDate(obj).getTime(); } @@ -1773,8 +1784,9 @@ // 关闭日期面板 laydate.close = function(id){ - var elem = lay('#'+ (id ? ('layui-laydate'+ id) : Class.thisElemDate)); - elem.remove(); + var that = thisModule.getThis(id || laydate.thisId); + if(!that) return; + return that.remove(); }; //加载方式