mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-26 14:21:17 +08:00

* docs: add general components TS demo * docs: add layout components TS demo * docs: add navigation components TS demo * docs: add data entry components TS demo * chore(deps): add types for qs * docs: add data display TS demo * docs: add feedback components TS demo * docs: add other components TS demo * chore(deps): add types * docs: unified demo code style * docs: fix lint error * docs: add demo TS type * docs: fix demo TS type * test: update snapshot * docs: fix TS demo * feat: update Rate character type * docs: fix lint error * feat: update Rate character type * feat: update Rate character type
51 lines
967 B
Markdown
51 lines
967 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.
|
|
|
|
```tsx
|
|
import React from 'react';
|
|
import { Tooltip, Button } from 'antd';
|
|
|
|
const wrapStyles: React.CSSProperties = {
|
|
overflow: 'hidden',
|
|
position: 'relative',
|
|
padding: '24px',
|
|
border: '1px solid #e9e9e9',
|
|
};
|
|
|
|
const App: React.FC = () => (
|
|
<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>
|
|
);
|
|
|
|
export default App;
|
|
```
|