mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-20 20:38:09 +08:00
6776bb8916
* docs: update demo * chore: add script * test: fix demo test * docs: convert demos * chore: move script * test: remove react-dom import * chore: update deps * docs: update riddle js * test: fix image test * docs: fix riddle demo
48 lines
889 B
Markdown
48 lines
889 B
Markdown
---
|
|
order: 3
|
|
title:
|
|
zh-CN: 自动调整位置
|
|
en-US: Adjust placement automatically
|
|
debug: true
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
气泡框不可见时自动调整位置
|
|
|
|
## en-US
|
|
|
|
Adjust placement automatically when tooltip is invisible.
|
|
|
|
```jsx
|
|
import { Tooltip, Button } from 'antd';
|
|
|
|
const wrapStyles = {
|
|
overflow: 'hidden',
|
|
position: 'relative',
|
|
padding: '24px',
|
|
border: '1px solid #e9e9e9',
|
|
};
|
|
|
|
export default () => (
|
|
<div style={wrapStyles}>
|
|
<Tooltip
|
|
placement="left"
|
|
title="Prompt Text"
|
|
getPopupContainer={trigger => trigger.parentElement}
|
|
>
|
|
<Button>Adjust automatically / 自动调整</Button>
|
|
</Tooltip>
|
|
<br />
|
|
<Tooltip
|
|
placement="left"
|
|
title="Prompt Text"
|
|
getPopupContainer={trigger => trigger.parentElement}
|
|
autoAdjustOverflow={false}
|
|
>
|
|
<Button>Ignore / 不处理</Button>
|
|
</Tooltip>
|
|
</div>
|
|
);
|
|
```
|