修复table重新渲染的内存泄漏
This commit is contained in:
25
dist/layui.js
vendored
25
dist/layui.js
vendored
@@ -18487,6 +18487,7 @@ layui.define('layer' , function(exports){
|
||||
,contentType: false
|
||||
,processData: false
|
||||
,dataType: 'json'
|
||||
,async: false
|
||||
,headers: options.headers || {}
|
||||
//成功回调
|
||||
,success: function(res){
|
||||
@@ -19719,7 +19720,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,cache: {} //数据缓存
|
||||
,allData:[] // 全部数据
|
||||
,index: layui.table ? (layui.table.index + 10000) : 0
|
||||
|
||||
,winResiz:[]
|
||||
//设置全局项
|
||||
,set: function(options){
|
||||
var that = this;
|
||||
@@ -20059,6 +20060,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
that.key = options.id || options.index;
|
||||
table.allData[that.key] = options.data
|
||||
|
||||
// 添加到全局渲染中,为了全局resize防止内存泄漏
|
||||
table.winResiz[that.key] = that
|
||||
//生成替代元素
|
||||
hasRender[0] && hasRender.remove(); //如果已经渲染,则Rerender
|
||||
othis.after(reElem);
|
||||
@@ -21344,6 +21347,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
}
|
||||
}
|
||||
that.config.onColumnsWidth && that.config.onColumnsWidth(that.config.cols)
|
||||
if (layui.soulTable) { layui.soulTable.fixTableRemember(that.config, dict) } //拖动列宽 记忆开启
|
||||
dict = {};
|
||||
_BODY.css('cursor', '');
|
||||
that.scrollPatch();
|
||||
@@ -21680,10 +21684,10 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
layer.close(that.tipsIndex);
|
||||
});
|
||||
|
||||
//自适应
|
||||
_WIN.on('resize', function(){
|
||||
that.resize();
|
||||
});
|
||||
// //自适应
|
||||
// _WIN.on('resize', function(){
|
||||
// that.resize();
|
||||
// });
|
||||
};
|
||||
|
||||
//一次性事件
|
||||
@@ -22060,6 +22064,17 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
$(function(){
|
||||
table.init();
|
||||
});
|
||||
|
||||
$(function (){
|
||||
//自适应
|
||||
_WIN.on('resize', function(){
|
||||
// that.resize();
|
||||
for(let i in table.winResiz){
|
||||
table.winResiz[i].resize()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
exports(MOD_NAME, table);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user