Explorar el Código

Table: fix lazy load data (#21041)

好多大米 hace 4 años
padre
commit
47158e96cb
Se han modificado 1 ficheros con 4 adiciones y 3 borrados
  1. 4 3
      packages/table/src/store/tree.js

+ 4 - 3
packages/table/src/store/tree.js

@@ -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;