国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

Vant2 IndexBar 索引欄

2025-09-02 12:03 更新

引入

import Vue from 'vue';
import { IndexBar, IndexAnchor } from 'vant';

Vue.use(IndexBar);
Vue.use(IndexAnchor);

代碼演示

基礎(chǔ)用法

點(diǎn)擊索引欄時(shí),會自動跳轉(zhuǎn)到對應(yīng)的 IndexAnchor 錨點(diǎn)位置。

<van-index-bar>
  <van-index-anchor index="A" />
  <van-cell title="文本" />
  <van-cell title="文本" />
  <van-cell title="文本" />

  <van-index-anchor index="B" />
  <van-cell title="文本" />
  <van-cell title="文本" />
  <van-cell title="文本" />

  ...
</van-index-bar>

自定義索引列表

可以通過 index-list 屬性自定義展示的索引字符列表。

<van-index-bar :index-list="indexList">
  <van-index-anchor index="1">標(biāo)題1</van-index-anchor>
  <van-cell title="文本" />
  <van-cell title="文本" />
  <van-cell title="文本" />

  <van-index-anchor index="2">標(biāo)題2</van-index-anchor>
  <van-cell title="文本" />
  <van-cell title="文本" />
  <van-cell title="文本" />

  ...
</van-index-bar>
export default {
  data() {
    return {
      indexList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    };
  },
};

API

IndexBar Props

參數(shù) 說明 類型 默認(rèn)值
index-list 索引字符列表 string[] | number[] A-Z
z-index z-index 層級 number | string 1
sticky 是否開啟錨點(diǎn)自動吸頂 boolean true
sticky-offset-top 錨點(diǎn)自動吸頂時(shí)與頂部的距離 number 0
highlight-color 索引字符高亮顏色 string #ee0a24

IndexAnchor Props

參數(shù) 說明 類型 默認(rèn)值
index 索引字符 number | string -

IndexBar Events

事件名 說明 回調(diào)參數(shù)
select 點(diǎn)擊索引欄的字符時(shí)觸發(fā) index: number | string
change v2.10.10 當(dāng)前高亮的索引字符變化時(shí)觸發(fā) index: number | string

IndexAnchor Slots

名稱 說明
default 錨點(diǎn)位置顯示內(nèi)容,默認(rèn)為索引字符

IndexBar 方法

通過 ref 可以獲取到 IndexBar 實(shí)例并調(diào)用實(shí)例方法,詳見組件實(shí)例方法。

方法名 說明 參數(shù) 返回值
scrollTo v2.12.2 滾動到指定錨點(diǎn) index: number | string -

樣式變量

組件提供了下列 Less 變量,可用于自定義樣式,使用方法請參考主題定制。

名稱 默認(rèn)值 描述
@index-bar-sidebar-z-index 2 -
@index-bar-index-font-size @font-size-xs -
@index-bar-index-line-height @line-height-xs -
@index-bar-index-active-color @red -
@index-anchor-z-index 1 -
@index-anchor-padding 0 @padding-md -
@index-anchor-text-color @text-color -
@index-anchor-font-weight @font-weight-bold -
@index-anchor-font-size @font-size-md -
@index-anchor-line-height 32px -
@index-anchor-background-color transparent -
@index-anchor-sticky-text-color @red -
@index-anchor-sticky-background-color @white -
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號