ant-design/components/dropdown/demo/placement.md

67 lines
1.4 KiB
Markdown
Raw Normal View History

---
order: 1
title:
zh-CN: 弹出位置
en-US: Placement
---
## zh-CN
支持 6 个弹出位置。
## en-US
Support 6 placements.
2019-05-07 14:57:32 +08:00
```jsx
2020-11-27 14:31:53 +08:00
import { Menu, Dropdown, Button, Space } from 'antd';
const menu = (
<Menu>
<Menu.Item>
<a target="_blank" rel="noopener noreferrer" href="https://www.antgroup.com">
2019-05-07 14:57:32 +08:00
1st menu item
</a>
</Menu.Item>
<Menu.Item>
<a target="_blank" rel="noopener noreferrer" href="https://www.aliyun.com">
2019-05-07 14:57:32 +08:00
2nd menu item
</a>
</Menu.Item>
<Menu.Item>
<a target="_blank" rel="noopener noreferrer" href="https://www.luohanacademy.com">
2019-05-07 14:57:32 +08:00
3rd menu item
</a>
</Menu.Item>
</Menu>
);
ReactDOM.render(
2020-11-27 14:31:53 +08:00
<Space direction="vertical">
<Space wrap>
<Dropdown overlay={menu} placement="bottomLeft">
<Button>bottomLeft</Button>
</Dropdown>
<Dropdown overlay={menu} placement="bottom">
<Button>bottom</Button>
2020-11-27 14:31:53 +08:00
</Dropdown>
<Dropdown overlay={menu} placement="bottomRight">
<Button>bottomRight</Button>
</Dropdown>
</Space>
<Space wrap>
<Dropdown overlay={menu} placement="topLeft">
<Button>topLeft</Button>
</Dropdown>
<Dropdown overlay={menu} placement="top">
<Button>top</Button>
2020-11-27 14:31:53 +08:00
</Dropdown>
<Dropdown overlay={menu} placement="topRight">
<Button>topRight</Button>
</Dropdown>
</Space>
</Space>,
2019-05-07 14:57:32 +08:00
mountNode,
2018-11-28 15:00:03 +08:00
);
2019-05-07 14:57:32 +08:00
```