You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
673 B

5 years ago
---
order: 99
title:
zh-CN: 调整浏览器大小,观察 Affix 容器是否发生变化。跟随变化为正常。#17678
en-US:
debug: true
5 years ago
---
## zh-CN
DEBUG
## en-US
DEBUG
```tsx
5 years ago
import { Affix, Button } from 'antd';
const Demo: React.FC = () => {
const [top, setTop] = React.useState(10);
return (
<div style={{ height: 10000 }}>
<div>Top</div>
<Affix offsetTop={top}>
<div style={{ background: 'red' }}>
<Button type="primary" onClick={() => setTop(top + 10)}>
Affix top
</Button>
</div>
</Affix>
<div>Bottom</div>
</div>
);
};
5 years ago
ReactDOM.render(<Demo />, mountNode);
```