Tony Wu
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
8 additions and
6 deletions
-
components/menu/index.en-US.md
-
components/menu/index.zh-CN.md
|
|
@ -29,11 +29,12 @@ ReactDOM.render(<Alert message="After version 4.20.0, we provide a simpler usage |
|
|
|
```jsx |
|
|
|
// works when >=4.20.0, recommended ✅ |
|
|
|
const items = [ |
|
|
|
{ label: 'item 1' }, |
|
|
|
{ label: 'item 2' }, |
|
|
|
{ label: 'item 1', key: 'item-1' }, // remember to pass the key prop |
|
|
|
{ label: 'item 2', key: 'item-2' }, // which is required |
|
|
|
{ |
|
|
|
label: 'sub menu', |
|
|
|
children: [{ label: 'item 3' }], |
|
|
|
key: 'submenu' |
|
|
|
children: [{ label: 'item 3', key: 'submenu-item-1' }], |
|
|
|
}, |
|
|
|
]; |
|
|
|
return <Menu items={items} />; |
|
|
|
|
|
@ -30,11 +30,12 @@ ReactDOM.render(<Alert message="在 4.20.0 版本后,我们提供了 <Menu ite |
|
|
|
```jsx |
|
|
|
// >=4.20.0 可用,推荐的写法 ✅ |
|
|
|
const items = [ |
|
|
|
{ label: '菜单项一' }, |
|
|
|
{ label: '菜单项二' }, |
|
|
|
{ label: '菜单项一', key: 'item-1' }, // 菜单项务必填写 key |
|
|
|
{ label: '菜单项二', key: 'item-2' }, |
|
|
|
{ |
|
|
|
label: '子菜单', |
|
|
|
children: [{ label: '子菜单项' }], |
|
|
|
key: 'submenu', |
|
|
|
children: [{ label: '子菜单项', key: 'submenu-item-1' }], |
|
|
|
}, |
|
|
|
]; |
|
|
|
return <Menu items={items} />; |
|
|
|