uniapp滑到元素底部
需要用到scroll-view这个标签:
scroll-y 允许纵向滚动
scroll-top 设置竖向滚动条位置
scroll-with-animation 在设置滚动条位置时使用动画过渡’
<scroll-view scroll-y="true" :scroll-top="scrollTop" scroll-with-animation="true">
// do some thing
</scroll-view>
scrollTop:99999,//滑到元素距离顶部的距离
需要注意的是,若给scroll-view增加新的子元素,且需要做到滚到底部时,scrollTop的值不能一样,否则没有效果,这时我们只需要在原有基础加一就好啦
setTimeout(()=>{
this.scrollTop = this.scrollTop + 1;
},300)