Browse Source

fix(directory-tree): expose scrollTo method. (#6067)

Co-authored-by: tan_qiang <tan.qiang@oushu.io>
pull/6071/head
QiangGuZi 2 years ago committed by GitHub
parent
commit
265233c34f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      components/tree/DirectoryTree.tsx

5
components/tree/DirectoryTree.tsx

@ -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…
Cancel
Save