优化 `table.reload()` 造成 `window resize` 事件重复绑定的问题

pull/1321/head
贤心 2023-08-10 12:50:24 +08:00
parent fe735b84df
commit ef1b952068
1 changed files with 11 additions and 9 deletions

View File

@ -2494,21 +2494,23 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
layer.close(that.tipsIndex); layer.close(that.tipsIndex);
}); });
// 适应
_WIN.on('resize', function(){
that.resize();
});
}; };
//一次性事件 // 全局事件
;(function(){ (function(){
//全局点击 // 自适应尺寸
_WIN.on('resize', function(){
layui.each(thisTable.that, function(){
this.resize();
});
});
// 全局点击
_DOC.on('click', function(){ _DOC.on('click', function(){
_DOC.trigger('table.remove.tool.panel'); _DOC.trigger('table.remove.tool.panel');
}); });
//工具面板移除事件 // 工具面板移除事件
_DOC.on('table.remove.tool.panel', function(){ _DOC.on('table.remove.tool.panel', function(){
$('.' + ELEM_TOOL_PANEL).remove(); $('.' + ELEM_TOOL_PANEL).remove();
}); });