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-24 19:20:47 +08:00
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-08-31 13:50:50 +08:00
|
|
|
位置有十二个方向。如需箭头指向目标元素中心,可以设置 `arrowPointAtCenter`。
|
2015-06-24 19:20:47 +08:00
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## en-US
|
|
|
|
|
2019-04-19 22:37:48 +08:00
|
|
|
There are 12 `placement` options available. Use `arrowPointAtCenter` if you want the arrow to point at the center of target.
|
2016-08-26 14:42:41 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-23 14:37:16 +08:00
|
|
|
import { Button, message, Popconfirm } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2015-10-28 20:55:49 +08:00
|
|
|
|
2018-07-29 00:58:10 +08:00
|
|
|
const text = 'Are you sure to delete this task?';
|
2015-06-24 19:20:47 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const confirm = () => {
|
2018-07-29 00:58:10 +08:00
|
|
|
message.info('Clicked on Yes.');
|
2022-05-19 09:46:26 +08:00
|
|
|
};
|
2015-06-24 19:20:47 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2017-10-09 13:23:20 +08:00
|
|
|
<div className="demo">
|
|
|
|
<div style={{ marginLeft: 70, whiteSpace: 'nowrap' }}>
|
|
|
|
<Popconfirm placement="topLeft" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
|
|
|
|
<Button>TL</Button>
|
|
|
|
</Popconfirm>
|
|
|
|
<Popconfirm placement="top" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
|
|
|
|
<Button>Top</Button>
|
|
|
|
</Popconfirm>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Popconfirm
|
|
|
|
placement="topRight"
|
|
|
|
title={text}
|
|
|
|
onConfirm={confirm}
|
|
|
|
okText="Yes"
|
|
|
|
cancelText="No"
|
|
|
|
>
|
2017-10-09 13:23:20 +08:00
|
|
|
<Button>TR</Button>
|
|
|
|
</Popconfirm>
|
|
|
|
</div>
|
|
|
|
<div style={{ width: 70, float: 'left' }}>
|
|
|
|
<Popconfirm placement="leftTop" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
|
|
|
|
<Button>LT</Button>
|
|
|
|
</Popconfirm>
|
|
|
|
<Popconfirm placement="left" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
|
|
|
|
<Button>Left</Button>
|
|
|
|
</Popconfirm>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Popconfirm
|
|
|
|
placement="leftBottom"
|
|
|
|
title={text}
|
|
|
|
onConfirm={confirm}
|
|
|
|
okText="Yes"
|
|
|
|
cancelText="No"
|
|
|
|
>
|
2017-10-09 13:23:20 +08:00
|
|
|
<Button>LB</Button>
|
|
|
|
</Popconfirm>
|
|
|
|
</div>
|
|
|
|
<div style={{ width: 70, marginLeft: 304 }}>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Popconfirm
|
|
|
|
placement="rightTop"
|
|
|
|
title={text}
|
|
|
|
onConfirm={confirm}
|
|
|
|
okText="Yes"
|
|
|
|
cancelText="No"
|
|
|
|
>
|
2017-10-09 13:23:20 +08:00
|
|
|
<Button>RT</Button>
|
|
|
|
</Popconfirm>
|
|
|
|
<Popconfirm placement="right" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
|
|
|
|
<Button>Right</Button>
|
|
|
|
</Popconfirm>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Popconfirm
|
|
|
|
placement="rightBottom"
|
|
|
|
title={text}
|
|
|
|
onConfirm={confirm}
|
|
|
|
okText="Yes"
|
|
|
|
cancelText="No"
|
|
|
|
>
|
2017-10-09 13:23:20 +08:00
|
|
|
<Button>RB</Button>
|
|
|
|
</Popconfirm>
|
|
|
|
</div>
|
|
|
|
<div style={{ marginLeft: 70, clear: 'both', whiteSpace: 'nowrap' }}>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Popconfirm
|
|
|
|
placement="bottomLeft"
|
|
|
|
title={text}
|
|
|
|
onConfirm={confirm}
|
|
|
|
okText="Yes"
|
|
|
|
cancelText="No"
|
|
|
|
>
|
2017-10-09 13:23:20 +08:00
|
|
|
<Button>BL</Button>
|
|
|
|
</Popconfirm>
|
|
|
|
<Popconfirm placement="bottom" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
|
|
|
|
<Button>Bottom</Button>
|
|
|
|
</Popconfirm>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Popconfirm
|
|
|
|
placement="bottomRight"
|
|
|
|
title={text}
|
|
|
|
onConfirm={confirm}
|
|
|
|
okText="Yes"
|
|
|
|
cancelText="No"
|
|
|
|
>
|
2017-10-09 13:23:20 +08:00
|
|
|
<Button>BR</Button>
|
|
|
|
</Popconfirm>
|
|
|
|
</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-24 19:20:47 +08:00
|
|
|
|
|
|
|
<style>
|
2017-10-16 19:53:46 +08:00
|
|
|
.code-box-demo .demo {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
2015-06-26 10:22:08 +08:00
|
|
|
.code-box-demo .ant-popover-wrap > a {
|
2016-10-07 15:20:10 +08:00
|
|
|
margin-right: 8px;
|
2015-06-24 19:20:47 +08:00
|
|
|
}
|
2015-11-04 17:50:49 +08:00
|
|
|
.code-box-demo .ant-btn {
|
2016-10-07 15:20:10 +08:00
|
|
|
margin-right: 8px;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
|
|
|
#components-popconfirm-demo-placement .ant-btn {
|
|
|
|
width: 70px;
|
2017-10-16 19:53:46 +08:00
|
|
|
text-align: center;
|
|
|
|
padding: 0;
|
2015-11-04 17:50:49 +08:00
|
|
|
}
|
2015-06-24 19:20:47 +08:00
|
|
|
</style>
|