修复 treeTable `reload(id)` 如果找不到 id 对应实例的时候出现报错问题

pull/1281/head
sunxiaobin89 2023-06-13 13:50:18 +08:00
parent 1b57e28a97
commit 94a951d392
1 changed files with 1 additions and 9 deletions

View File

@ -54,11 +54,6 @@ layui.define(['table'], function (exports) {
return that || null; return that || null;
} }
// 获取当前实例配置项
var getThisTableConfig = function (id) {
return getThisTable(id).config;
}
// 字符 // 字符
var MOD_NAME = 'treeTable'; var MOD_NAME = 'treeTable';
var HIDE = 'layui-hide'; var HIDE = 'layui-hide';
@ -1856,12 +1851,9 @@ layui.define(['table'], function (exports) {
// 重载 // 重载
treeTable.reload = function (id, options, deep, type) { treeTable.reload = function (id, options, deep, type) {
deep = deep !== false; // 默认采用深拷贝 deep = deep !== false; // 默认采用深拷贝
var config = getThisTableConfig(id); // 获取当前实例配置项
if (!config) return;
var that = getThisTable(id); var that = getThisTable(id);
if (!that) return;
that.reload(options, deep, type); that.reload(options, deep, type);
return thisTreeTable.call(that); return thisTreeTable.call(that);
}; };