ant-design/components/tooltip/demo/auto-adjust-overflow.md

49 lines
897 B
Markdown
Raw Normal View History

---
order: 3
title:
zh-CN: 自动调整位置
en-US: Adjust placement automatically
2017-07-14 10:42:01 +08:00
debug: true
---
## zh-CN
气泡框不可见时自动调整位置
## en-US
2019-04-19 20:46:08 +08:00
Adjust placement automatically when tooltip is invisible.
2019-05-07 14:57:32 +08:00
```jsx
import { Tooltip, Button } from 'antd';
const wrapStyles = {
overflow: 'hidden',
position: 'relative',
padding: '24px',
border: '1px solid #e9e9e9',
};
ReactDOM.render(
<div style={wrapStyles}>
2019-05-07 14:57:32 +08:00
<Tooltip
placement="left"
title="Prompt Text"
getPopupContainer={trigger => trigger.parentElement}
>
<Button>Adjust automatically / 自动调整</Button>
</Tooltip>
<br />
2019-05-07 14:57:32 +08:00
<Tooltip
placement="left"
title="Prompt Text"
getPopupContainer={trigger => trigger.parentElement}
autoAdjustOverflow={false}
>
2019-04-19 20:46:08 +08:00
<Button>Ignore / 不处理</Button>
</Tooltip>
2018-06-27 15:55:04 +08:00
</div>,
2019-05-07 14:57:32 +08:00
mountNode,
2018-11-28 15:00:03 +08:00
);
2019-05-07 14:57:32 +08:00
```