Browse Source

修复insertNodesByKey方法批量添加异常问题 (#2695)

当批量添加节点parentKey为空时,未赋值treeDataRef导致添加异常
pull/2697/head
zhenbintuo 3 years ago
committed by GitHub
parent
commit
cfbd5e9851
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/components/Tree/src/hooks/useTree.ts

2
src/components/Tree/src/hooks/useTree.ts

@ -141,6 +141,8 @@ export function useTree(treeDataRef: Ref<TreeDataItem[]>, getFieldNames: Compute
for (let i = 0; i < list.length; i++) {
treeData[push](list[i]);
}
treeDataRef.value = treeData;
return;
} else {
const { key: keyField, children: childrenField } = unref(getFieldNames);
if (!childrenField || !keyField) return;

Loading…
Cancel
Save