Merge pull request #1193 from layui/main

同步近期 PR 到 2.x 分支
This commit is contained in:
贤心 2023-01-29 01:17:03 +08:00 committed by GitHub
commit cc0b67d27a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -16,10 +16,10 @@
<img src="https://img.shields.io/github/license/layui/layui" alt="License">
</a>
<a href="https://github.com/layui/layui/blob/master/dist/css/layui.css">
<img src="https://img.badgesize.io/layui/layui/master/dist/css/layui.css?compression=brotli&label=CSS Brotli size" alt="CSS Brotli size">
<img src="https://img.badgesize.io/layui/layui/master/dist/css/layui.css?compression=brotli&label=CSS%20Brotli%20size" alt="CSS Brotli size">
</a>
<a href="https://github.com/layui/layui/blob/master/dist/layui.js">
<img src="https://img.badgesize.io/layui/layui/master/dist/layui.js?compression=brotli&label=JS Brotli size" alt="JS Brotli size">
<img src="https://img.badgesize.io/layui/layui/master/dist/layui.js?compression=brotli&label=JS%20Brotli%20size" alt="JS Brotli size">
</a>
</p>

View File

@ -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; //不触发事件