@@ -24,6 +24,7 @@ const subMenuProps = {
24
24
popupOffset : Array as PropType < number [ ] > ,
25
25
internalPopupClose : Boolean ,
26
26
eventKey : String ,
27
+ expandIcon : Function as PropType < ( p ?: { isOpen : boolean ; [ key : string ] : any } ) => any > ,
27
28
} ;
28
29
29
30
export type SubMenuProps = Partial < ExtractPropTypes < typeof subMenuProps > > ;
@@ -32,7 +33,7 @@ export default defineComponent({
32
33
name : 'ASubMenu' ,
33
34
inheritAttrs : false ,
34
35
props : subMenuProps ,
35
- slots : [ 'icon' , 'title' ] ,
36
+ slots : [ 'icon' , 'title' , 'expandIcon' ] ,
36
37
emits : [ 'titleClick' , 'mouseenter' , 'mouseleave' ] ,
37
38
setup ( props , { slots, attrs, emit } ) {
38
39
useProvideFirstLevel ( false ) ;
@@ -84,6 +85,7 @@ export default defineComponent({
84
85
selectedSubMenuEventKeys,
85
86
motion,
86
87
defaultMotions,
88
+ expandIcon : menuExpandIcon ,
87
89
} = useInjectMenu ( ) ;
88
90
89
91
registerMenuInfo ( eventKey , menuInfo ) ;
@@ -226,6 +228,7 @@ export default defineComponent({
226
228
const icon = getPropsSlot ( slots , props , 'icon' ) ;
227
229
const title = renderTitle ( getPropsSlot ( slots , props , 'title' ) , icon ) ;
228
230
const subMenuPrefixClsValue = subMenuPrefixCls . value ;
231
+ const expandIcon = props . expandIcon || slots . expandIcon || menuExpandIcon ;
229
232
let titleNode = (
230
233
< div
231
234
style = { directionStyle . value }
@@ -244,8 +247,8 @@ export default defineComponent({
244
247
{ title }
245
248
246
249
{ /* Only non-horizontal mode shows the icon */ }
247
- { mode . value !== 'horizontal' && slots . expandIcon ? (
248
- slots . expandIcon ( { ...props , isOpen : open . value } )
250
+ { mode . value !== 'horizontal' && expandIcon ? (
251
+ expandIcon ( { ...props , isOpen : open . value } )
249
252
) : (
250
253
< i class = { `${ subMenuPrefixClsValue } -arrow` } />
251
254
) }
0 commit comments