From 3c8d20d23d256e8309e7d42d52540cb9654f18f8 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, 19 Jun 2023 17:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20table=20`colTool`=20?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=EF=BC=8C=E7=82=B9=E5=87=BB=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=85=83=E7=B4=A0=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E5=8D=87=20table=20=E7=9A=84=E5=8F=AF?= =?UTF-8?q?=E7=8E=A9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/css/layui.css | 2 ++ src/modules/table.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/css/layui.css b/src/css/layui.css index 64c206b7..f44e9f6a 100644 --- a/src/css/layui.css +++ b/src/css/layui.css @@ -1011,7 +1011,9 @@ a cite{font-style: normal; *cursor:pointer;} .layui-table-view .layui-table[lay-skin="row"]{border-width: 0; border-bottom-width: 1px;} .layui-table-view .layui-table th, .layui-table-view .layui-table td{padding: 0; border-top: none; border-left: none;} +.layui-table-view .layui-table th [lay-event], .layui-table-view .layui-table th.layui-unselect .layui-table-cell span{cursor: pointer;} +.layui-table-view .layui-table th span, .layui-table-view .layui-table td{cursor: default;} .layui-table-view .layui-table td[data-edit]{cursor: text;} .layui-table-view .layui-table td[data-edit]:hover:after{position: absolute; left: 0; top: 0; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid #16B777; pointer-events: none; content: "";} diff --git a/src/modules/table.js b/src/modules/table.js index 47c2aa9c..9ecb5314 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -1948,6 +1948,21 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ },{})); }); + // 表头自定义元素事件 + that.layHeader.on('click', '*[lay-event]', function(e){ + var othis = $(this); + var events = othis.attr('lay-event'); + var th = othis.closest('th'); + var key = th.data('key'); + var col = that.col(key); + + layui.event.call(this, MOD_NAME, 'colTool('+ filter +')', $.extend({ + event: events, + config: options, + col: col + },{})); + }); + // 分页栏操作事件 that.layPagebar.on('click', '*[lay-event]', function(e){ var othis = $(this);