mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 21:59:41 +08:00
22 lines
374 B
Markdown
22 lines
374 B
Markdown
---
|
|
order: 3
|
|
title: 固定状态改变的回调
|
|
---
|
|
|
|
可以获得是否固定的状态。
|
|
|
|
````jsx
|
|
import { Affix, Button } from 'antd';
|
|
|
|
|
|
const onChange = function (affixed) {
|
|
console.log(affixed); // true or false
|
|
};
|
|
|
|
ReactDOM.render(
|
|
<Affix offsetTop={120} onChange={onChange}>
|
|
<Button>固定在距离顶部 120px 的位置</Button>
|
|
</Affix>
|
|
, mountNode);
|
|
````
|