Commit 47158e96 authored by 好多大米's avatar 好多大米 Committed by GitHub

Table: fix lazy load data (#21041)

parent e1e65b31
...@@ -187,13 +187,14 @@ export default { ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment