Explorar o código

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

当批量添加节点parentKey为空时,未赋值treeDataRef导致添加异常
zhenbintuo %!s(int64=2) %!d(string=hai) anos
pai
achega
cfbd5e9851
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/components/Tree/src/hooks/useTree.ts

+ 2 - 0
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;