Commit 5a20df45ad36b523d48bf7fe11bdb10a6d03df64

Authored by 无木
1 parent d52b0de8

feat(tree): add `insertNodesByKey` method

src/components/Tree/src/Tree.vue
@@ -97,8 +97,7 @@ @@ -97,8 +97,7 @@
97 }, 97 },
98 onRightClick: handleRightClick, 98 onRightClick: handleRightClick,
99 }; 99 };
100 - propsData = omit(propsData, 'treeData', 'class');  
101 - return propsData; 100 + return omit(propsData, 'treeData', 'class');
102 }); 101 });
103 102
104 const getTreeData = computed((): TreeItem[] => 103 const getTreeData = computed((): TreeItem[] =>
@@ -109,8 +108,14 @@ @@ -109,8 +108,14 @@
109 return searchState.startSearch && searchState.searchData?.length === 0; 108 return searchState.startSearch && searchState.searchData?.length === 0;
110 }); 109 });
111 110
112 - const { deleteNodeByKey, insertNodeByKey, filterByLevel, updateNodeByKey, getAllKeys } =  
113 - useTree(treeDataRef, getReplaceFields); 111 + const {
  112 + deleteNodeByKey,
  113 + insertNodeByKey,
  114 + insertNodesByKey,
  115 + filterByLevel,
  116 + updateNodeByKey,
  117 + getAllKeys,
  118 + } = useTree(treeDataRef, getReplaceFields);
114 119
115 function getIcon(params: Recordable, icon?: string) { 120 function getIcon(params: Recordable, icon?: string) {
116 if (!icon) { 121 if (!icon) {
@@ -267,6 +272,7 @@ @@ -267,6 +272,7 @@
267 setCheckedKeys, 272 setCheckedKeys,
268 getCheckedKeys, 273 getCheckedKeys,
269 insertNodeByKey, 274 insertNodeByKey,
  275 + insertNodesByKey,
270 deleteNodeByKey, 276 deleteNodeByKey,
271 updateNodeByKey, 277 updateNodeByKey,
272 checkAll, 278 checkAll,