mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-10 14:10:15 +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);
|
||
|
````
|