fix(directory-tree): expose scrollTo method. (#6067)
Co-authored-by: tan_qiang <tan.qiang@oushu.io>pull/6071/head
parent
639b746ba5
commit
265233c34f
|
@ -18,6 +18,7 @@ import { conductExpandParent } from '../vc-tree/util';
|
|||
import { calcRangeKeys, convertDirectoryKeysToNodes } from './utils/dictUtil';
|
||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||
import { filterEmpty } from '../_util/props-util';
|
||||
import { ScrollTo } from "../vc-tree/interface";
|
||||
|
||||
export type ExpandAction = false | 'click' | 'doubleclick' | 'dblclick';
|
||||
|
||||
|
@ -81,7 +82,11 @@ export default defineComponent({
|
|||
const cachedSelectedKeys = ref<Key[]>();
|
||||
const fieldNames = computed(() => fillFieldNames(props.fieldNames));
|
||||
const treeRef = ref();
|
||||
const scrollTo: ScrollTo = scroll => {
|
||||
treeRef.value?.scrollTo(scroll);
|
||||
};
|
||||
expose({
|
||||
scrollTo,
|
||||
selectedKeys: computed(() => treeRef.value?.selectedKeys),
|
||||
checkedKeys: computed(() => treeRef.value?.checkedKeys),
|
||||
halfCheckedKeys: computed(() => treeRef.value?.halfCheckedKeys),
|
||||
|
|
Loading…
Reference in New Issue