Skip to content

Commit

Permalink
Table: fix lazy load data (ElemeFE#21041)
Browse files Browse the repository at this point in the history
  • Loading branch information
cs1707 authored and cn3lfs committed Feb 24, 2022
1 parent 6ebf3e4 commit 5731a6d
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 5731a6d

Please sign in to comment.