Browse Source
fix(treeHelper): 修复 listToTree 方法 parent 获取 children 问题 (#1464)
pull/1474/head
XC
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
1 deletions
-
src/utils/helper/treeHelper.ts
|
|
|
@ -24,7 +24,7 @@ export function listToTree<T = any>(list: any[], config: Partial<TreeHelperConfi |
|
|
|
} |
|
|
|
for (const node of list) { |
|
|
|
const parent = nodeMap.get(node[pid]); |
|
|
|
(parent ? parent.children : result).push(node); |
|
|
|
(parent ? parent[children] : result).push(node); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|