Skip to content

Commit 265233c

Browse files
fix(directory-tree): expose scrollTo method. (#6067)
Co-authored-by: tan_qiang <[email protected]>
1 parent 639b746 commit 265233c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

components/tree/DirectoryTree.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { conductExpandParent } from '../vc-tree/util';
1818
import { calcRangeKeys, convertDirectoryKeysToNodes } from './utils/dictUtil';
1919
import useConfigInject from '../_util/hooks/useConfigInject';
2020
import { filterEmpty } from '../_util/props-util';
21+
import { ScrollTo } from "../vc-tree/interface";
2122

2223
export type ExpandAction = false | 'click' | 'doubleclick' | 'dblclick';
2324

@@ -81,7 +82,11 @@ export default defineComponent({
8182
const cachedSelectedKeys = ref<Key[]>();
8283
const fieldNames = computed(() => fillFieldNames(props.fieldNames));
8384
const treeRef = ref();
85+
const scrollTo: ScrollTo = scroll => {
86+
treeRef.value?.scrollTo(scroll);
87+
};
8488
expose({
89+
scrollTo,
8590
selectedKeys: computed(() => treeRef.value?.selectedKeys),
8691
checkedKeys: computed(() => treeRef.value?.checkedKeys),
8792
halfCheckedKeys: computed(() => treeRef.value?.halfCheckedKeys),

0 commit comments

Comments
 (0)