|
@@ -110,12 +110,12 @@
|
|
|
return omit(propsData, 'treeData', 'class') as TreeProps;
|
|
|
});
|
|
|
|
|
|
- const getTreeData = computed((): TreeItem[] =>
|
|
|
+ const getTreeSearchData = computed((): TreeItem[] =>
|
|
|
searchState.startSearch ? searchState.searchData : unref(treeDataRef),
|
|
|
);
|
|
|
|
|
|
const getNotFound = computed((): boolean => {
|
|
|
- return !getTreeData.value || getTreeData.value.length === 0;
|
|
|
+ return !getTreeSearchData.value || getTreeSearchData.value.length === 0;
|
|
|
});
|
|
|
|
|
|
const {
|
|
@@ -158,6 +158,10 @@
|
|
|
createContextMenu(contextMenuOptions);
|
|
|
}
|
|
|
|
|
|
+ function getTreeData() {
|
|
|
+ return unref(treeDataRef);
|
|
|
+ }
|
|
|
+
|
|
|
function setExpandedKeys(keys: KeyType[]) {
|
|
|
state.expandedKeys = keys;
|
|
|
}
|
|
@@ -320,7 +324,7 @@
|
|
|
});
|
|
|
|
|
|
const instance: TreeActionType = {
|
|
|
- getTreeData: () => treeDataRef,
|
|
|
+ getTreeData,
|
|
|
setExpandedKeys,
|
|
|
getExpandedKeys,
|
|
|
setSelectedKeys,
|
|
@@ -367,7 +371,7 @@
|
|
|
}
|
|
|
|
|
|
const treeData = computed(() => {
|
|
|
- const data = cloneDeep(getTreeData.value);
|
|
|
+ const data = cloneDeep(getTreeSearchData.value);
|
|
|
eachTree(data, (item, _parent) => {
|
|
|
const searchText = searchState.searchText;
|
|
|
const { highlight } = unref(props);
|