From c7ba2e3851ff955985ddd4a7bafe36ee5c1bfd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Wed, 31 Aug 2022 01:59:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BE=AE=E8=B0=83=20laydate=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/laydate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index b76b1441..79de8ed5 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -46,8 +46,8 @@ isLayui ? ( layui['layui.all'] - ? (typeof callback === 'function' && callback()) - : layui.addcss(path, callback, cssname) + ? (typeof callback === 'function' && callback()) + : layui.addcss(path, callback, cssname) ) : ready.link(path, callback, cssname); return this; From 2803cbe4ab95a87769bdfbf83cf46bc17c3d0e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Wed, 31 Aug 2022 23:49:29 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=BE=AE=E8=B0=83=20table=20=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E9=A1=B5=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/table-test.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/table-test.html b/examples/table-test.html index 0ac450b1..fe82c525 100644 --- a/examples/table-test.html +++ b/examples/table-test.html @@ -2,7 +2,7 @@ - + 表格操作 - layui From fcdd9fd7151809823dbd1d0d944062536c503228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Wed, 31 Aug 2022 23:51:02 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=20table=20=E7=9A=84=20te?= =?UTF-8?q?mplet=20=E5=87=BD=E6=95=B0=EF=BC=8C=E8=BF=94=E5=9B=9E=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8C=85=E5=90=AB=20`LAY=5FCOL`=20=E7=89=B9?= =?UTF-8?q?=E5=AE=9A=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/modules/table.js b/src/modules/table.js index 2027c8d8..70e4606f 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -21,7 +21,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ config: { // 全局配置项 checkName: 'LAY_CHECKED' // 是否选中状态的字段名 ,indexName: 'LAY_TABLE_INDEX' // 初始下标索引名,用于恢复当前页表格排序 - ,numbersName: 'LAY_INDEX' //序号 + ,numbersName: 'LAY_INDEX' // 序号 ,disabledName: 'LAY_DISABLED' } ,cache: {} // 数据缓存 @@ -1065,7 +1065,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ // 记录下标索引,用于恢复排序 if(!sort) item1[table.config.indexName] = i1; - //遍历表头 + // 遍历表头 that.eachCols(function(i3, item3){ var field = item3.field || i3; var key = item3.key; @@ -1103,9 +1103,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ + function(){ var tplData = $.extend(true, { LAY_COL: item3 - }, item1) - ,checkName = table.config.checkName - ,disabledName = table.config.disabledName; + }, item1); + var checkName = table.config.checkName; + var disabledName = table.config.disabledName; //渲染不同风格的列 switch(item3.type){ @@ -1909,11 +1909,10 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ //数据行中的事件返回的公共对象成员 var commonMember = that.commonMember = function(sets){ - var othis = $(this) - ,index = othis.parents('tr').eq(0).data('index') - ,tr = that.layBody.find('tr[data-index="'+ index +'"]') - ,data = table.cache[that.key] || []; - + var othis = $(this); + var index = othis.parents('tr').eq(0).data('index'); + var tr = that.layBody.find('tr[data-index="'+ index +'"]'); + var data = table.cache[that.key] || []; data = data[index] || {}; @@ -1941,7 +1940,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ cell.html(parseTempData.call(that, { item3: item3 ,content: value - ,tplData: data + ,tplData: $.extend({ + LAY_COL: item3 + }, data) })); td.data('content', value); } @@ -1953,7 +1954,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ thisTd.children(ELEM_CELL).html(parseTempData.call(that, { item3: item3 ,content: content - ,tplData: data + ,tplData: $.extend({ + LAY_COL: item3 + }, data) })); thisTd.data('content', content); }