主要利用了scroll-view里面的属性
一.首先是静态布局
{{item.title}}
{{items.title}}
{{it}}
二.script中的内容
export default {
data() {
return {
list:[
{title:"中餐",list:['盖饭','扒饭','鸡骨头','鸡肉']},
{title:"西餐",list:['牛排','羊排','鸡排','猪排']},
{title:"南餐",list:['胡萝卜','青椒','炒鸡蛋','西虹市']},
{title:"北餐",list:['锅包肉','肉包','杀猪菜','血肠']}
],
currentIndex:0,
doms:'',
topList:[]
}
},
onLoad() {
},
onReady(){
this.getNodesInfo()
},
methods: {
scrolltolower(){
setTimeout(()=>{
this.currentIndex =3
},80)
},
scrolls(e){
let scrollTop = e.target.scrollTop
for(let i =0;i=h1&&scrollTop{
let nodes = res[0]
let rel =[];
nodes.map(item=>{
rel.push(item.top)
})
this.topList =rel
})
},
changeactive(index){
this.currentIndex =index
this.doms = 'po'+index
}
}
}
三.css样式