@@ -65,6 +65,7 @@ export default defineComponent({
6565 disabled : false ,
6666 checkStrictly : false ,
6767 draggable : false ,
68+ expandAction : false ,
6869 defaultExpandParent : true ,
6970 autoExpandParent : false ,
7071 defaultExpandAll : false ,
@@ -617,16 +618,34 @@ export default defineComponent({
617618
618619 dragNode = null ;
619620 } ;
621+ const triggerExpandActionExpand : NodeMouseEventHandler = ( e , treeNode ) => {
622+ const { expanded, key } = treeNode ;
623+
624+ const node = flattenNodes . value . filter ( nodeItem => nodeItem . key === key ) [ 0 ] ;
625+ const eventNode = convertNodePropsToEventData ( {
626+ ...getTreeNodeProps ( key , treeNodeRequiredProps . value ) ,
627+ data : node . data ,
628+ } ) ;
629+ setExpandedKeys ( expanded ? arrDel ( expandedKeys . value , key ) : arrAdd ( expandedKeys . value , key ) ) ;
630+
631+ onNodeExpand ( e , eventNode ) ;
632+ } ;
620633
621634 const onNodeClick : NodeMouseEventHandler = ( e , treeNode ) => {
622- const { onClick } = props ;
635+ const { onClick, expandAction } = props ;
636+ if ( expandAction === 'click' ) {
637+ triggerExpandActionExpand ( e , treeNode ) ;
638+ }
623639 if ( onClick ) {
624640 onClick ( e , treeNode ) ;
625641 }
626642 } ;
627643
628644 const onNodeDoubleClick : NodeMouseEventHandler = ( e , treeNode ) => {
629- const { onDblclick } = props ;
645+ const { onDblclick, expandAction } = props ;
646+ if ( expandAction === 'doubleclick' || expandAction === 'dblclick' ) {
647+ triggerExpandActionExpand ( e , treeNode ) ;
648+ }
630649 if ( onDblclick ) {
631650 onDblclick ( e , treeNode ) ;
632651 }
@@ -1107,6 +1126,8 @@ export default defineComponent({
11071126 onContextmenu,
11081127 onScroll,
11091128 direction,
1129+ rootClassName,
1130+ rootStyle,
11101131 } = props ;
11111132
11121133 const { class : className , style } = attrs ;
@@ -1179,11 +1200,12 @@ export default defineComponent({
11791200 >
11801201 < div
11811202 role = "tree"
1182- class = { classNames ( prefixCls , className , {
1203+ class = { classNames ( prefixCls , className , rootClassName , {
11831204 [ `${ prefixCls } -show-line` ] : showLine ,
11841205 [ `${ prefixCls } -focused` ] : focused . value ,
11851206 [ `${ prefixCls } -active-focused` ] : activeKey . value !== null ,
11861207 } ) }
1208+ style = { rootStyle }
11871209 >
11881210 < NodeList
11891211 ref = { listRef }
0 commit comments