ant-design/components/dropdown/demo/sub-menu.md

85 lines
1.4 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 6
2016-07-04 10:48:21 +08:00
title:
zh-CN: 多级菜单
en-US: Cascading menu
2016-03-31 09:40:55 +08:00
---
2016-07-04 10:48:21 +08:00
## zh-CN
传入的菜单里有多个层级。
2016-07-04 10:48:21 +08:00
## en-US
The menu has multiple levels.
```tsx
import React from 'react';
2022-04-22 13:35:27 +08:00
import { Menu, Dropdown, Space } from 'antd';
import { DownOutlined } from '@ant-design/icons';
2018-06-27 15:55:04 +08:00
const menu = (
<Menu
items={[
{
key: '1',
type: 'group',
label: 'Group title',
children: [
{
key: '1-1',
label: '1st menu item',
},
{
key: '1-2',
label: '2nd menu item',
},
],
},
{
key: '2',
label: 'sub menu',
children: [
{
key: '2-1',
label: '3rd menu item',
},
{
key: '2-2',
label: '4th menu item',
},
],
},
{
key: '3',
label: 'disabled sub menu',
disabled: true,
children: [
{
key: '3-1',
label: '5d menu item',
},
{
key: '3-2',
label: '6th menu item',
},
],
},
]}
/>
);
const App: React.FC = () => (
<Dropdown overlay={menu}>
2022-04-22 13:35:27 +08:00
<a onClick={e => e.preventDefault()}>
<Space>
Cascading menu
<DownOutlined />
</Space>
</a>
</Dropdown>
2018-11-28 15:00:03 +08:00
);
export default App;
2019-05-07 14:57:32 +08:00
```