<van-tabs
  active="{{ activeTab }}"
  bind:change="onChange"
>
  <van-tab title="基础用法">
    <van-index-bar
      wx:if="{{ activeTab === 0 }}"
      scroll-top="{{ scrollTop }}"
    >
      <view
        wx:for="{{ indexList }}"
        wx:for-item="item"
        wx:key="item"
      >
        <van-index-anchor index="{{ item }}" />
        <van-cell title="文本" />
        <van-cell title="文本" />
        <van-cell title="文本" />
      </view>
    </van-index-bar>
  </van-tab>

  <van-tab title="自定义索引列表">
    <van-index-bar
      wx:if="{{ activeTab === 1 }}"
      index-list="{{ customIndexList }}"
      scroll-top="{{ scrollTop }}"
    >
      <view
        wx:for="{{ customIndexList }}"
        wx:key="index"
      >
        <van-index-anchor
          use-slot
          index="{{ item }}"
        >
          <text>标题{{ item }}</text>
        </van-index-anchor>
        <van-cell title="文本" />
        <van-cell title="文本" />
        <van-cell title="文本" />
      </view>
    </van-index-bar>
  </van-tab>
</van-tabs>