1.html页面
2.vue中script
export default{
data(){
return{
hosptalLists:[{hospitalName:["四川大学华西医院1","四川大学华西医院1","四川大学华西医院1"],charactor:"A"},{hospitalName:["四川大学华西医院2","四川大学华西医院2","四川大学华西医院2"],charactor:"B"},{hospitalName:["四川大学华西医院3","四川大学华西医院3","四川大学华西医院3","四川大学华西医院3"],charactor:"C"},{hospitalName:["四川大学华西医院4","四川大学华西医院4","四川大学华西医院4"],charactor:"D"},{hospitalName:["四川大学华西医院5","四川大学华西医院5","四川大学华西医院5"],charactor:"E"},{hospitalName:["四川大学华西医院6","四川大学华西医院6","四川大学华西医院6"],charactor:"F"},{hospitalName:["四川大学华西医院7","四川大学华西医院7","四川大学华西医院7"],charactor:"Z"}],
charactorAll:['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
active:"",//select-active
}
},
methods:{
scrollTo:function(item){
for(var i=0;i
var element=document.getElementById(item) //利用Id找到对应的需要滚动的区域
var height1=element.offsetTop-44 //获取滚动区域到页面顶部的距离
uni.pageScrollTo({//uni-app中页面滚动接口
scrollTop:height1,//滚动到页面的目标位置(单位px)
duration:100 //滚动动画的时长,默认300ms,单位 ms
})
}
}
}
}
}