Skip to content
在新窗口打开实时预览

IndexListPanel 容器索引列表 ​

用于弹窗、抽屉和定高区域的索引列表。组件内部创建 scroll-view,不依赖页面滚动位置。

平台兼容性 ​

H5App微信小程序支付宝小程序
√√√√

基础用法 ​

父容器必须提供确定高度。

vue
<view style="height: 600rpx">
  <snake-index-list-panel :index-list="['A', 'B']" @select="onSelect">
    <snake-index-anchor index="A" />
    <view>Apple</view>
    <snake-index-anchor index="B" />
    <view>Banana</view>
  </snake-index-list-panel>
</view>

API ​

Props ​

参数说明类型默认值
indexList右侧索引值Array<string | number>[]
scrollTop内部容器目标滚动位置number | string0
zIndex索引栏和吸顶锚点层级number965
sticky锚点是否吸顶booleantrue
offsetTop容器内吸顶偏移string | number0
activeColor / inactiveColor当前和默认索引颜色string主题色 / 弱文本色
railStyle右侧索引栏样式string | object | array''
customClass / customStyle自定义类名和样式string | object | array''

Events ​

事件名触发时机参数
select点击或拖动选择索引索引值
change当前分组变化{ index, value }

Expose ​

方法说明
scrollTo(indexOrValue)滚动到序号或索引值
update()内容尺寸变化后重新测量锚点

Slots ​

插槽名说明
default索引锚点及对应的分组内容

主题变量 ​

变量名说明
--snake-color-primary当前索引默认颜色
--snake-color-text-muted未激活索引默认颜色
--snake-color-primary-light当前索引提示层背景颜色

为 uni-app 商城与 CMS 场景设计