From be35ed0b55ff068360097f8bdb04d7370ac03780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E6=96=87=E5=81=A5?= Date: Wed, 4 Jan 2023 16:08:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=96=87=E8=8F=9C=E5=8D=95=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加行的上下文菜单事件和是否显示系统默认上下文菜单事件的配置,方便在表格行上使用`layui.dropdown`组件。 ```html 开始使用 layui
``` --- src/modules/table.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/table.js b/src/modules/table.js index a780d981..15a00427 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -305,6 +305,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ ,cellMaxWidth: Number.MAX_VALUE // 所有单元格默认最大宽度 ,editTrigger: 'click' // 单元格编辑的事件触发方式 ,defaultToolbar: ['filter', 'exports', 'print'] // 工具栏右侧图标 + ,defaultContextmenu: true // 显示默认上下文菜单 ,autoSort: true // 是否前端自动排序。如果否,则需自主排序(通常为服务端处理好排序) ,text: { none: '无数据' @@ -2067,9 +2068,12 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ setRowEvent.call(this, 'row'); }).on('dblclick', 'tr', function(){ //双击行 setRowEvent.call(this, 'rowDouble'); - }); + }).on('contextmenu', 'tr', function(e){ //菜单 + if (!options.defaultContextmenu) e.preventDefault(); + setRowEvent.call(this, 'contextmenu'); + });; - // 创建行单击、双击事件 + // 创建行单击、双击、菜单事件 var setRowEvent = function(eventType){ var othis = $(this); if(othis.data('off')) return; //不触发事件 From b80b1038eb348600785713dafaf1a95503a4289e Mon Sep 17 00:00:00 2001 From: "jerry.zhou" Date: Mon, 9 Jan 2023 18:08:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0readme=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=ADJS=E5=92=8CCSS=E7=9A=84Brotli=20size=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E5=9C=A8github=E4=B8=AD=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ebde731..ad7663f9 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,10 @@ License - CSS Brotli size + CSS Brotli size - JS Brotli size + JS Brotli size