Browse Source

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

当批量添加节点parentKey为空时,未赋值treeDataRef导致添加异常
zhenbintuo 2 năm trước cách đây
mục cha
commit
cfbd5e9851
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  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;