You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
864 B
55 lines
864 B
2 years ago
|
---
|
||
|
order: 10
|
||
|
title:
|
||
|
zh-CN: 菜单可选选择
|
||
|
en-US: Selectable Menu
|
||
|
---
|
||
|
|
||
|
## zh-CN
|
||
|
|
||
|
为 Menu 添加 `selectable` 属性可以开启选择能力。
|
||
|
|
||
|
## en-US
|
||
|
|
||
|
Config Menu `selectable` prop to enable selectable ability.
|
||
|
|
||
|
```tsx
|
||
|
import { DownOutlined } from '@ant-design/icons';
|
||
|
import { Dropdown, Menu, Space, Typography } from 'antd';
|
||
|
import React from 'react';
|
||
|
|
||
|
const menu = (
|
||
|
<Menu
|
||
|
selectable
|
||
|
defaultSelectedKeys={['3']}
|
||
|
items={[
|
||
|
{
|
||
|
key: '1',
|
||
|
label: 'Item 1',
|
||
|
},
|
||
|
{
|
||
|
key: '2',
|
||
|
label: 'Item 2',
|
||
|
},
|
||
|
{
|
||
|
key: '3',
|
||
|
label: 'Item 3',
|
||
|
},
|
||
|
]}
|
||
|
/>
|
||
|
);
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Dropdown overlay={menu}>
|
||
|
<Typography.Link>
|
||
|
<Space>
|
||
|
Selectable
|
||
|
<DownOutlined />
|
||
|
</Space>
|
||
|
</Typography.Link>
|
||
|
</Dropdown>
|
||
|
);
|
||
|
|
||
|
export default App;
|
||
|
```
|