修复table重新渲染的内存泄漏
This commit is contained in:
parent
526d1cbec1
commit
c3ac588bdb
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"svn.ignoreMissingSvnWarning": true
|
||||
}
|
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);
|
||||
});
|
||||
|
14
package.json
14
package.json
@ -12,21 +12,23 @@
|
||||
},
|
||||
"homepage": "https://github.com/layui/layui/",
|
||||
"devDependencies": {
|
||||
"del": "^2.2.2",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"gulp-clean-css": "^4.3.0",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-replace": "^1.1.3",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-header": "^2.0.9",
|
||||
"gulp-footer": "^2.1.0",
|
||||
"del": "^2.2.2",
|
||||
"gulp-header": "^2.0.9",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-replace": "^1.1.3",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"minimist": "^1.2.5"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitee.com/sentsin/layui/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"dependencies": {
|
||||
"layui": "file:"
|
||||
},
|
||||
"keywords": [
|
||||
"layui",
|
||||
"ui",
|
||||
|
@ -25,7 +25,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;
|
||||
@ -365,6 +365,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);
|
||||
@ -1650,6 +1652,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();
|
||||
@ -1986,10 +1989,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();
|
||||
// });
|
||||
};
|
||||
|
||||
//一次性事件
|
||||
@ -2366,6 +2369,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);
|
||||
});
|
||||
|
@ -210,6 +210,7 @@ layui.define('layer' , function(exports){
|
||||
,contentType: false
|
||||
,processData: false
|
||||
,dataType: 'json'
|
||||
,async: false
|
||||
,headers: options.headers || {}
|
||||
//成功回调
|
||||
,success: function(res){
|
||||
|
Loading…
Reference in New Issue
Block a user