Table: fix lazy load data (#21041)

This commit is contained in:
好多大米 2021-06-03 15:34:00 +08:00 committed by GitHub
parent e1e65b3182
commit 47158e96cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -187,13 +187,14 @@ export default {
loadData(row, key, treeNode) { loadData(row, key, treeNode) {
const { load } = this.table; const { load } = this.table;
const { lazyTreeNodeMap, treeData } = this.states; const { treeData: rawTreeData } = this.states;
if (load && !treeData[key].loaded) { if (load && !rawTreeData[key].loaded) {
treeData[key].loading = true; rawTreeData[key].loading = true;
load(row, treeNode, data => { load(row, treeNode, data => {
if (!Array.isArray(data)) { if (!Array.isArray(data)) {
throw new Error('[ElTable] data must be an array'); throw new Error('[ElTable] data must be an array');
} }
const { lazyTreeNodeMap, treeData } = this.states;
treeData[key].loading = false; treeData[key].loading = false;
treeData[key].loaded = true; treeData[key].loaded = true;
treeData[key].expanded = true; treeData[key].expanded = true;