2017-06-30 17:22:01 +08:00
|
|
|
---
|
|
|
|
order: 3
|
|
|
|
title:
|
|
|
|
zh-CN: 自动调整位置
|
|
|
|
en-US: Adjust placement automatically
|
2017-07-14 10:42:01 +08:00
|
|
|
debug: true
|
2017-06-30 17:22:01 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
气泡框不可见时自动调整位置
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2019-04-19 20:46:08 +08:00
|
|
|
Adjust placement automatically when tooltip is invisible.
|
2017-06-30 17:22:01 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-23 14:37:16 +08:00
|
|
|
import { Button, Tooltip } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2017-06-30 17:22:01 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const wrapStyles: React.CSSProperties = {
|
2017-06-30 17:22:01 +08:00
|
|
|
overflow: 'hidden',
|
|
|
|
position: 'relative',
|
|
|
|
padding: '24px',
|
|
|
|
border: '1px solid #e9e9e9',
|
|
|
|
};
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2017-06-30 17:22:01 +08:00
|
|
|
<div style={wrapStyles}>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Tooltip
|
|
|
|
placement="left"
|
|
|
|
title="Prompt Text"
|
2022-05-19 09:46:26 +08:00
|
|
|
getPopupContainer={trigger => trigger.parentElement!}
|
2019-05-07 14:57:32 +08:00
|
|
|
>
|
2017-06-30 17:22:01 +08:00
|
|
|
<Button>Adjust automatically / 自动调整</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
2019-05-07 14:57:32 +08:00
|
|
|
<Tooltip
|
|
|
|
placement="left"
|
|
|
|
title="Prompt Text"
|
2022-05-19 09:46:26 +08:00
|
|
|
getPopupContainer={trigger => trigger.parentElement!}
|
2019-05-07 14:57:32 +08:00
|
|
|
autoAdjustOverflow={false}
|
|
|
|
>
|
2019-04-19 20:46:08 +08:00
|
|
|
<Button>Ignore / 不处理</Button>
|
2017-06-30 17:22:01 +08:00
|
|
|
</Tooltip>
|
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
|
|
|
```
|