先上效果图:
引用微信小程序官方的 scroll-view 组件 https://developers.weixin.qq.com/miniprogram/dev/component/scroll-view.html
主要通过更改:scroll-into-view="toView"的内容 很方便就 写出效果 记着加scroll-with-animation 就有动画过渡的效果!
分字母城市列表 LetterCity 链接:https://pan.baidu.com/s/126kgYEIBPwc8z-UgKcV4GQ 提取码:wt8u
主要代码(文章下面有全部代码):
<template>
//右边定位列表
<div class="right_Letter">
<div class="Letter_list" v-for="(item,index) in LetterCity" :key="index" @click="addClassName(index,item.letter)" :class="{active:index == thatnum}">{
{item.letter}}</div>
</div>
//左边滚动区域
<scroll-view class="longinPage_scroll" :scroll-y="true" @scrolltolower="scrolltolower" @scroll="scroll" :scroll-into-view="toView" :scroll-with-animation="true">
<div class="Letter_city" v-for="(item,index) in LetterCity" :key="index" :id=&