2016-05-26 16:06:15 +08:00
|
|
|
---
|
2016-10-30 15:11:22 +08:00
|
|
|
order: 1
|
2016-07-10 08:56:02 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 固定状态改变的回调
|
|
|
|
en-US: Callback
|
2016-05-26 16:06:15 +08:00
|
|
|
---
|
|
|
|
|
2016-07-10 08:56:02 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-05-26 16:06:15 +08:00
|
|
|
可以获得是否固定的状态。
|
|
|
|
|
2016-07-10 08:56:02 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Callback with affixed state.
|
|
|
|
|
2020-01-21 16:21:37 +08:00
|
|
|
```tsx
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2016-05-26 16:06:15 +08:00
|
|
|
import { Affix, Button } from 'antd';
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2016-07-09 16:00:05 +08:00
|
|
|
<Affix offsetTop={120} onChange={affixed => console.log(affixed)}>
|
2016-07-10 08:56:02 +08:00
|
|
|
<Button>120px to affix top</Button>
|
2022-04-03 23:27:45 +08:00
|
|
|
</Affix>
|
2016-10-30 15:11:22 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|