@@ -9,6 +9,7 @@ import { parseChildren } from './commonUtil';
99function convertItemsToNodes (
1010 list : ItemType [ ] ,
1111 components : Required < Components > ,
12+ prefixCls ?: string ,
1213) {
1314 const {
1415 item : MergedMenuItem ,
@@ -20,7 +21,7 @@ function convertItemsToNodes(
2021 return ( list || [ ] )
2122 . map ( ( opt , index ) => {
2223 if ( opt && typeof opt === 'object' ) {
23- const { label, children, key, type, ...restProps } = opt as any ;
24+ const { label, children, key, type, extra , ...restProps } = opt as any ;
2425 const mergedKey = key ?? `tmp-${ index } ` ;
2526
2627 // MenuItemGroup & SubMenuItem
@@ -50,6 +51,9 @@ function convertItemsToNodes(
5051 return (
5152 < MergedMenuItem key = { mergedKey } { ...restProps } >
5253 { label }
54+ { ( ! ! extra || extra === 0 ) && (
55+ < span className = { `${ prefixCls } -extra` } > { extra } </ span >
56+ ) }
5357 </ MergedMenuItem >
5458 ) ;
5559 }
@@ -64,6 +68,7 @@ export function parseItems(
6468 items : ItemType [ ] | undefined ,
6569 keyPath : string [ ] ,
6670 components : Components ,
71+ prefixCls ?: string ,
6772) {
6873 let childNodes = children ;
6974
@@ -76,7 +81,7 @@ export function parseItems(
7681 } ;
7782
7883 if ( items ) {
79- childNodes = convertItemsToNodes ( items , mergedComponents ) ;
84+ childNodes = convertItemsToNodes ( items , mergedComponents , prefixCls ) ;
8085 }
8186
8287 return parseChildren ( childNodes , keyPath ) ;
0 commit comments