Scroll-view 中有一个属性 scroll-into-view
注意
:scroll-into-view值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素
注意要在scroll-view的子元素中加入属性绑定一个id
:id=“’top’+index” index 为v-for 循环 数据的下标值
所以在 scoll-view 上加入这个属性
:scroll-into-view=“‘top’+index”
Data中加入一个数据 topintoindex:‘top1’
在scoll的点击事件中加入
this.topintoindex=’top’+index
这样样就能解决scroll-view 滑块的跟随问题了