微信小程序 使用Vant Weapp框架中IndexBar索引栏字母不动问题

wxml
<view wx:if="{
      {hasUserInfo}}">
  <navbar page-name="页签标题">navbar>
  <van-transition custom-class="hellow-block" show="{
      { hellowShow }}" name="fade-down">
    {
    { isNow }}好:{
    { userInfo.nickName }}van-transition>
  <view class="contain">
    <van-index-bar  scroll-top="{
      { scrollTop }}" highlight-color='#FF8B00'>
      <view wx:for="{
      { customerData }}" wx:key="index">
        <van-index-anchor index="{
      { item.letter }}" />
        <van-cell  wx:for="{
      { item.customerList }}"  wx:for-item="im" title="{
      { im.name }}" />
      view>


    van-index-bar>

  view>
view>
js
const app = getApp()
import util from '../../utils/util.js';

Page({
     
  data: {
     
    scrollTop: 0,
    isNow: '早上好',
    customerData: [{
     
        letter: 'A',
        customerList: [{
     
            'name': 'A客户'
          },
          {
     
            'name': 'A客户'
          },
          {
     
            'name': 'A客户'
          }
        ]
      }, {
     
        letter: 'B',
        customerList: [{
     
            'name': 'B客户'
          },
          {
     
            'name': 'B客户'
          }
        ]
      }, {
     
        letter: 'C',
        customerList: [{
     
            'name': 'C客户'
          },
          {
     
            'name': 'C客户'
          },
        ]
      },

    ]
  },
 // 加上onPageScroll 即可解决
  onPageScroll(event) {
     
    this.scrollTop = event.scrollTop;
  },

你可能感兴趣的:(前端,小程序,前端)