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.
|
|
|
|
|
2017-01-19 15:19:03 +08:00
|
|
|
````__react
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Popover, Button } from 'antd';
|
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;
|
|
|
|
|
2016-01-07 16:29:12 +08:00
|
|
|
ReactDOM.render(
|
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>
|
2016-10-07 15:30:05 +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>
|
2015-11-04 20:48:51 +08:00
|
|
|
</div>
|
2016-01-07 16:29:12 +08:00
|
|
|
, mountNode);
|
2015-06-17 16:58:13 +08:00
|
|
|
````
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.code-box-demo .ant-btn {
|
2016-10-07 15:20:10 +08:00
|
|
|
margin-right: 8px;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
|
|
|
#components-popover-demo-placement .ant-btn {
|
|
|
|
width: 70px;
|
2015-06-17 16:58:13 +08:00
|
|
|
}
|
|
|
|
</style>
|