小程序scroll-view 实现瞄点

<scroll-view :style="{height:autoHeight}" :scroll-y="true" @scrolltolower="scrolltolower" @scroll="scroll"  :scroll-into-view="toView" :scroll-with-animation="true" :enable-back-to-top="true">
<div v-for="(item,index) in cityArr" :key="index">
<p :id="item.initial">{{ item.initial }}</p>
<div>
<!-- :style="{marginRight:(childrenIndex%3 === 2) ? 0 : ‘26rpx‘ }" -->
<div v-for="(citys,childrenIndex) in item.chooseCitys" :key="childrenIndex">
<div :class="{ activeFlex:citys.length === 2 }">
<div v-for=‘(j,k) in citys‘ :key="k" :class="{ activeColor:activeIndex === childrenIndex && bgIndex === index && lastIndex === k }" @click="chooseCity(item,index,citys,childrenIndex,j,k)" >{{ j.short_name }}</div>
</div>
</div>
</div>
</div>
</scroll-view>

默认是toView:‘A‘,

// 选择的时候赋值上
// chooseLetter 是你点击的地方,
// toView  是你想要跳的地方
chooseLetter(item,index){
this.Tips(item);
if (item === ‘A‘) {
this.toView = ‘A‘ ;
} else {
this.toView = item ;
}
console.log(this.toView,‘this.toView‘)
},

小程序scroll-view 实现瞄点

原文:https://www.cnblogs.com/panax/p/14464507.html

以上是小程序scroll-view 实现瞄点的全部内容。
THE END
分享
二维码
)">
< <上一篇
)">
下一篇>>