2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-10-14 21:45:48 +08:00
|
|
|
order: 2
|
2016-08-26 14:42:41 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 位置
|
|
|
|
en-US: Placement
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-06-17 16:58:13 +08:00
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-09-28 21:02:04 +08:00
|
|
|
位置有十二个方向。
|
2015-06-17 16:58:13 +08:00
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
There are 12 `placement` options available.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-23 14:37:16 +08:00
|
|
|
import { Button, Popover } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2015-10-08 15:13:04 +08:00
|
|
|
|
2016-09-29 13:43:55 +08:00
|
|
|
const text = <span>Title</span>;
|
2016-01-07 16:29:12 +08:00
|
|
|
const content = (
|
2016-04-29 12:13:27 +08:00
|
|
|
<div>
|
2016-09-29 13:43:55 +08:00
|
|
|
<p>Content</p>
|
|
|
|
<p>Content</p>
|
2016-04-29 12:13:27 +08:00
|
|
|
</div>
|
2016-01-07 16:29:12 +08:00
|
|
|
);
|
2015-06-17 16:58:13 +08:00
|
|
|
|
2016-10-07 15:20:10 +08:00
|
|
|
const buttonWidth = 70;
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2016-10-07 15:20:10 +08:00
|
|
|
<div className="demo">
|
|
|
|
<div style={{ marginLeft: buttonWidth, whiteSpace: 'nowrap' }}>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="topLeft" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>TL</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="top" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>Top</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="topRight" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>TR</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
|
|
|
</div>
|
2016-10-07 15:20:10 +08:00
|
|
|
<div style={{ width: buttonWidth, float: 'left' }}>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="leftTop" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>LT</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="left" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>Left</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="leftBottom" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>LB</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
|
|
|
</div>
|
2019-05-07 14:57:32 +08:00
|
|
|
<div style={{ width: buttonWidth, marginLeft: buttonWidth * 4 + 24 }}>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="rightTop" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>RT</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="right" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>Right</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="rightBottom" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>RB</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
|
|
|
</div>
|
2016-10-07 15:20:10 +08:00
|
|
|
<div style={{ marginLeft: buttonWidth, clear: 'both', whiteSpace: 'nowrap' }}>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="bottomLeft" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>BL</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="bottom" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>Bottom</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
2016-04-01 14:28:35 +08:00
|
|
|
<Popover placement="bottomRight" title={text} content={content} trigger="click">
|
2016-09-29 13:43:55 +08:00
|
|
|
<Button>BR</Button>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Popover>
|
|
|
|
</div>
|
2022-04-03 23:27:45 +08:00
|
|
|
</div>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2015-06-17 16:58:13 +08:00
|
|
|
|
|
|
|
<style>
|
2017-10-16 19:53:46 +08:00
|
|
|
.code-box-demo .demo {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
2015-06-17 16:58:13 +08:00
|
|
|
.code-box-demo .ant-btn {
|
2016-10-07 15:20:10 +08:00
|
|
|
margin-right: 8px;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
2020-04-30 21:04:19 +08:00
|
|
|
.code-box-demo .ant-btn-rtl {
|
|
|
|
margin-right: 0;
|
|
|
|
margin-left: 8px;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
2016-10-07 15:20:10 +08:00
|
|
|
#components-popover-demo-placement .ant-btn {
|
|
|
|
width: 70px;
|
2017-10-16 19:53:46 +08:00
|
|
|
text-align: center;
|
|
|
|
padding: 0;
|
2015-06-17 16:58:13 +08:00
|
|
|
}
|
|
|
|
</style>
|