Skip to content

Commit

Permalink
Table: fix lazy load data (#21041)
Browse files Browse the repository at this point in the history
  • Loading branch information
cs1707 committed Jun 3, 2021
1 parent e1e65b3 commit 47158e9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/table/src/store/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,14 @@ export default {

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

0 comments on commit 47158e9

Please sign in to comment.