@@ -9,6 +9,7 @@ import { parseChildren } from './commonUtil';
9
9
function convertItemsToNodes (
10
10
list : ItemType [ ] ,
11
11
components : Required < Components > ,
12
+ prefixCls ?: string ,
12
13
) {
13
14
const {
14
15
item : MergedMenuItem ,
@@ -20,7 +21,7 @@ function convertItemsToNodes(
20
21
return ( list || [ ] )
21
22
. map ( ( opt , index ) => {
22
23
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 ;
24
25
const mergedKey = key ?? `tmp-${ index } ` ;
25
26
26
27
// MenuItemGroup & SubMenuItem
@@ -50,6 +51,9 @@ function convertItemsToNodes(
50
51
return (
51
52
< MergedMenuItem key = { mergedKey } { ...restProps } >
52
53
{ label }
54
+ { ( ! ! extra || extra === 0 ) && (
55
+ < span className = { `${ prefixCls } -extra` } > { extra } </ span >
56
+ ) }
53
57
</ MergedMenuItem >
54
58
) ;
55
59
}
@@ -64,6 +68,7 @@ export function parseItems(
64
68
items : ItemType [ ] | undefined ,
65
69
keyPath : string [ ] ,
66
70
components : Components ,
71
+ prefixCls ?: string ,
67
72
) {
68
73
let childNodes = children ;
69
74
@@ -76,7 +81,7 @@ export function parseItems(
76
81
} ;
77
82
78
83
if ( items ) {
79
- childNodes = convertItemsToNodes ( items , mergedComponents ) ;
84
+ childNodes = convertItemsToNodes ( items , mergedComponents , prefixCls ) ;
80
85
}
81
86
82
87
return parseChildren ( childNodes , keyPath ) ;
0 commit comments