@@ -24,6 +24,7 @@ const subMenuProps = {
2424 popupOffset : Array as PropType < number [ ] > ,
2525 internalPopupClose : Boolean ,
2626 eventKey : String ,
27+ expandIcon : Function as PropType < ( p ?: { isOpen : boolean ; [ key : string ] : any } ) => any > ,
2728} ;
2829
2930export type SubMenuProps = Partial < ExtractPropTypes < typeof subMenuProps > > ;
@@ -32,7 +33,7 @@ export default defineComponent({
3233 name : 'ASubMenu' ,
3334 inheritAttrs : false ,
3435 props : subMenuProps ,
35- slots : [ 'icon' , 'title' ] ,
36+ slots : [ 'icon' , 'title' , 'expandIcon' ] ,
3637 emits : [ 'titleClick' , 'mouseenter' , 'mouseleave' ] ,
3738 setup ( props , { slots, attrs, emit } ) {
3839 useProvideFirstLevel ( false ) ;
@@ -84,6 +85,7 @@ export default defineComponent({
8485 selectedSubMenuEventKeys,
8586 motion,
8687 defaultMotions,
88+ expandIcon : menuExpandIcon ,
8789 } = useInjectMenu ( ) ;
8890
8991 registerMenuInfo ( eventKey , menuInfo ) ;
@@ -226,6 +228,7 @@ export default defineComponent({
226228 const icon = getPropsSlot ( slots , props , 'icon' ) ;
227229 const title = renderTitle ( getPropsSlot ( slots , props , 'title' ) , icon ) ;
228230 const subMenuPrefixClsValue = subMenuPrefixCls . value ;
231+ const expandIcon = props . expandIcon || slots . expandIcon || menuExpandIcon ;
229232 let titleNode = (
230233 < div
231234 style = { directionStyle . value }
@@ -244,8 +247,8 @@ export default defineComponent({
244247 { title }
245248
246249 { /* 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 } )
249252 ) : (
250253 < i class = { `${ subMenuPrefixClsValue } -arrow` } />
251254 ) }
0 commit comments