2018-11-27 12:01:30 +08:00
|
|
|
---
|
|
|
|
order: 21
|
|
|
|
title:
|
|
|
|
zh-CN: 扩展菜单
|
|
|
|
en-US: Custom dropdown
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
使用 `dropdownRender` 对下拉菜单进行自由扩展。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Customize the dropdown menu via `dropdownRender`.
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2018-11-27 12:01:30 +08:00
|
|
|
import { Select, Icon, Divider } from 'antd';
|
|
|
|
|
2019-05-27 21:32:45 +08:00
|
|
|
const { Option } = Select;
|
2018-11-27 12:01:30 +08:00
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<Select
|
|
|
|
defaultValue="lucy"
|
|
|
|
style={{ width: 120 }}
|
|
|
|
dropdownRender={menu => (
|
|
|
|
<div>
|
|
|
|
{menu}
|
|
|
|
<Divider style={{ margin: '4px 0' }} />
|
|
|
|
<div style={{ padding: '8px', cursor: 'pointer' }}>
|
|
|
|
<Icon type="plus" /> Add item
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<Option value="jack">Jack</Option>
|
|
|
|
<Option value="lucy">Lucy</Option>
|
|
|
|
</Select>,
|
2018-12-01 00:24:16 +08:00
|
|
|
mountNode,
|
|
|
|
);
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|