Skip to content

Affix 固钉 ​

将页面工具条或关键按钮固定在视口顶部或底部可视范围内,滚动越过阈值时自动吸附并保持原占位高度不抖动。

顶部固定 ​

vue
<template>
  <VbAffix :offset-top="80" @change="onAffixChange">
    <VbButton type="primary">吸顶工具按钮</VbButton>
  </VbAffix>
</template>

API ​

属性名说明类型默认值
offsetTop距离视口顶部达到该偏移量后触发固定(px)number0
offsetBottom距离视口底部达到该偏移量后触发固定(px)number—
zIndex固定时的层级number1020
@change固定状态变化回调(affixed: boolean) => void—

基于 MIT 协议开源发布 · @vobo-design/ui v0.5.0