Affix
Fix the element to a specific visible area.
Basic usage
Affix is fixed at the top of the page by default.
You can set offset
attribute to change the offset top,the default value is 0.
Target Container
You can set target
attribute to keep the affix in the container at all times. It will be hidden if out of range.
Please notice that the container avoid having scrollbar.
Fixed Position
The affix component provides two fixed positions: top
and bottom
.
You can set position
attribute to change the fixed position, the default value is top
.
Affix Attributes
Name | Description | Type | Default |
---|---|---|---|
offset | offset distance. | number | 0 |
position | position of affix. | top/bottom | top |
target | target container. (CSS selector) | string | — |
z-index | z-index of affix | number | 100 |
Affix Events
Name | Description | Type |
---|---|---|
change | triggers when fixed state changed. | (fixed: boolean) => void |
scroll | triggers when scrolling. | (value: { scrollTop: number, fixed: boolean }) => void |
Affix Exposes
Method | Description | Type |
---|---|---|
update | update affix state manually | () => void |
Affix Slots
Name | Description |
---|---|
default | customize default content. |