scroll-view点击跳转到指定位置,scroll-into-view利用id跳转
·
view内容:根据id实现跳转。
<scroll-view
scroll-y="true"
:scroll-into-view="toViewId"
>
<template v-if="goodsInProgressData.length>0&&goodsInProgressData" >
<view v-for="(item,index) in goodsInProgressData"
class="bottomCon-box" @tap="toGoodIdAct(item.id)"
:key="item.id"
id="scrollYgoodsInProgress"
>
</view>
<view id="scrollYendOfGoods2"></view>
<view v-for="(item,index) in endOfGoodsData"
id="scrollYendOfGoods"
:key="item.id"
@tap="toGoodId(item.id)" class="bottomCon-box">
</view>
</template>
</scroll-view>
data内容:
toViewId:"",
js内容
midToEndOfGoodsData(){
this.toViewId="scrollYendOfGoods2";
},
可重复跳转js内容:
midToEndOfGoodsData(){
if(this.toViewId=="scrollYendOfGoods2"){
this.toViewId="scrollYendOfGoods";
}else if(this.toViewId=="scrollYendOfGoods"){
this.toViewId="scrollYendOfGoods2";
}else{
this.toViewId="scrollYendOfGoods";
}
},
更多推荐
所有评论(0)