Browse Source

fix(treeHelper): 修复 listToTree 方法 parent 获取 children 问题 (#1464)

XC 3 years ago
parent
commit
b70fade587
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/utils/helper/treeHelper.ts

+ 1 - 1
src/utils/helper/treeHelper.ts

@@ -24,7 +24,7 @@ export function listToTree<T = any>(list: any[], config: Partial<TreeHelperConfi
   }
   }
   for (const node of list) {
   for (const node of list) {
     const parent = nodeMap.get(node[pid]);
     const parent = nodeMap.get(node[pid]);
-    (parent ? parent.children : result).push(node);
+    (parent ? parent[children] : result).push(node);
   }
   }
   return result;
   return result;
 }
 }