File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -220,10 +220,10 @@ export interface TreeProps {
220220
221221 /** 渲染节点数量,可见节点数大于此值且高度超过(容器可视高度能容纳节点数 + bufferNodeAmount)则不会渲染所有可见节点 */
222222 renderNodeAmount? : number ,
223-
223+
224224 /** 根据节点最小高度计算数据总高度 */
225225 nodeMinHeight? : number ,
226-
226+
227227 /** 当滚动到视野外的节点个数大于此值时刷新渲染节点 */
228228 bufferNodeAmount? : number ,
229229}
@@ -288,6 +288,7 @@ import { usePublicTreeAPI } from '../hooks/usePublicTreeAPI'
288288import { FilterFunctionType } from ' ../store/tree-store'
289289import { pickReadonly } from ' ../utils'
290290import { useExpandAnimation } from ' ../hooks/useExpandAnimation'
291+ import {ArgumentsType } from " vitest" ;
291292
292293const props = withDefaults (defineProps <TreeProps >(), DEFAULT_TREE_PROPS )
293294
@@ -677,6 +678,17 @@ const treeNodePropKeys = [
677678
678679const treeNodeProps = reactive (pickReadonly (toRefs (props ), ... treeNodePropKeys ))
679680
681+ const setExpandExpose = (... args : ArgumentsType <typeof setExpand >) => {
682+ if (props .animation ) {
683+ const node = getNode (args [0 ]);
684+ if (node ) {
685+ expandAnimation .updateBeforeExpand (node )
686+ }
687+ }
688+
689+ setExpand (... args )
690+ }
691+
680692defineExpose ({
681693 setData ,
682694 setChecked ,
@@ -685,7 +697,7 @@ defineExpose({
685697 clearChecked ,
686698 setSelected ,
687699 clearSelected ,
688- setExpand ,
700+ setExpand: setExpandExpose ,
689701 setExpandKeys ,
690702 setExpandAll ,
691703 getCheckedNodes ,
You can’t perform that action at this time.
0 commit comments