Skip to content

Sticky

演示

Sticky 跨端示例与演示

滚动页面查看月份摘要吸顶

2026 年 5 月8 笔订单
跟随页面
#1042已发货
¥279
#1041已完成
¥168
#1040待付款
¥99
#1039已完成
¥428
#1038已退款
−¥68
#1037已完成
¥319
#1036已完成
¥86
#1035已完成
¥206

跟随页面 · 页面滚动 0px

基础用法

vue
<template>
  <VSticky>
    <div class="sticky-bar">吸顶区域</div>
  </VSticky>
</template>

顶部偏移

vue
<template>
  <VSticky :offset-top="12" :z-index="10">
    <div class="sticky-bar">距离顶部 12px</div>
  </VSticky>
</template>

监听状态

vue
<template>
  <VSticky @change="fixed => console.log(fixed)" @scroll="event => console.log(event)">
    <div class="sticky-bar">吸顶区域</div>
  </VSticky>
</template>

Props

Prop类型默认值描述
offsetTopnumber | string0吸顶时距离顶部的距离
zIndexnumber | stringundefined层级
disabledbooleanfalse是否禁用吸顶行为

Events

EventPayload描述
changeboolean固定状态变化
scroll{ isFixed: boolean; scrollTop: number }页面滚动时触发

Slots

Slot描述
default吸顶内容,slot props 包含 fixed

Primitives

Sticky 有滚动状态和事件,因此 H5 / Weapp 均提供 StickyRoot primitive;DividerGridLayoutSpace 是静态布局展示组件,直接在 UI 层实现。