mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
docs: update docs of Affix
This commit is contained in:
parent
9ac4e6ea44
commit
17cadbb3fa
@ -19,3 +19,11 @@ Please note that Affix should not cover other content in page, especially when t
|
|||||||
| offsetTop | Pixels to offset from top when calculating position of scroll | Number | 0 |
|
| offsetTop | Pixels to offset from top when calculating position of scroll | Number | 0 |
|
||||||
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | Number | - |
|
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | Number | - |
|
||||||
| onChange | Callback when affix state is changed | Function(affixed) | - |
|
| onChange | Callback when affix state is changed | Function(affixed) | - |
|
||||||
|
|
||||||
|
**Note:** Children of `Affix` can not be `position: absolute`, but you can set `Affix` as `position: absolute`:
|
||||||
|
|
||||||
|
```jsx
|
||||||
|
<Affix style={{ position: 'absolute', top: y, left: x}}>
|
||||||
|
...
|
||||||
|
</Affix>
|
||||||
|
```
|
||||||
|
@ -15,10 +15,17 @@ english: Affix
|
|||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
|
|
||||||
| 成员 | 说明 | 类型 | 默认值 |
|
| 成员 | 说明 | 类型 | 默认值 |
|
||||||
|-------------|----------------|--------------------|--------------|
|
|-------------|----------------|--------------------|--------------|
|
||||||
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | |
|
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | |
|
||||||
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | |
|
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | |
|
||||||
| target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | Function | () => window |
|
| target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | Function | () => window |
|
||||||
| onChange | 固定状态改变时触发的回调函数 | Function(affixed) | 无 |
|
| onChange | 固定状态改变时触发的回调函数 | Function(affixed) | 无 |
|
||||||
|
|
||||||
|
**注意:**`Affix` 内的元素不要使用绝对定位,如需要绝对定位的效果,可以直接设置 `Affix` 为绝对定位:
|
||||||
|
|
||||||
|
```jsx
|
||||||
|
<Affix style={{ position: 'absolute', top: y, left: x}}>
|
||||||
|
...
|
||||||
|
</Affix>
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user