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

当批量添加节点parentKey为空时,未赋值treeDataRef导致添加异常
This commit is contained in:
zhenbintuo 2023-04-08 00:03:11 +08:00 committed by GitHub
parent 122db78e84
commit cfbd5e9851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

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