File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -220,10 +220,10 @@ export interface TreeProps {
220
220
221
221
/** 渲染节点数量,可见节点数大于此值且高度超过(容器可视高度能容纳节点数 + bufferNodeAmount)则不会渲染所有可见节点 */
222
222
renderNodeAmount? : number ,
223
-
223
+
224
224
/** 根据节点最小高度计算数据总高度 */
225
225
nodeMinHeight? : number ,
226
-
226
+
227
227
/** 当滚动到视野外的节点个数大于此值时刷新渲染节点 */
228
228
bufferNodeAmount? : number ,
229
229
}
@@ -288,6 +288,7 @@ import { usePublicTreeAPI } from '../hooks/usePublicTreeAPI'
288
288
import { FilterFunctionType } from ' ../store/tree-store'
289
289
import { pickReadonly } from ' ../utils'
290
290
import { useExpandAnimation } from ' ../hooks/useExpandAnimation'
291
+ import {ArgumentsType } from " vitest" ;
291
292
292
293
const props = withDefaults (defineProps <TreeProps >(), DEFAULT_TREE_PROPS )
293
294
@@ -677,6 +678,17 @@ const treeNodePropKeys = [
677
678
678
679
const treeNodeProps = reactive (pickReadonly (toRefs (props ), ... treeNodePropKeys ))
679
680
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
+
680
692
defineExpose ({
681
693
setData ,
682
694
setChecked ,
@@ -685,7 +697,7 @@ defineExpose({
685
697
clearChecked ,
686
698
setSelected ,
687
699
clearSelected ,
688
- setExpand ,
700
+ setExpand: setExpandExpose ,
689
701
setExpandKeys ,
690
702
setExpandAll ,
691
703
getCheckedNodes ,
You can’t perform that action at this time.
0 commit comments