右侧字母控件
<view style="position: fixed;right: 15px;top: 210px;font-size: 12px;">
<view style="margin-top: 10px;text-align: center;"
v-for="(item, index) in list" :key="index"@click="toSelectIndex(index)">
{{ item.title }}</view>
</view>
数据
data() {
return {
list: [{
title: 'A'
}, {
title: 'B'
}, {
title: 'C'
}, {
title: 'D'
}, {
title: 'F'
}, {
title: 'G'
}, {
title: 'H'
}, {
title: 'I'
}, ],
distance: 100
}
},
方法:
methods: {
toSelectIndex(value) {
console.log(value);
this.distance = 140 + value * 200
uni.pageScrollTo({
scrollTop: this.distance,
duration: 300
});
},
},