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

82 lines
1.2 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 9
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 { DownOutlined } from '@ant-design/icons';
import type { MenuProps } from 'antd';
import { Dropdown, Space } from 'antd';
2022-05-23 14:37:16 +08:00
import React from 'react';
const items: MenuProps['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 menu={{ items }}>
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
```