uniapp组件scroll-view 上拉加载数据问题

 @scrolltolower="bottomOut()"是scroll-view的触底触发事件

<scroll-view :scroll-y="true" class="scrollView" @scrolltolower="bottomOut()">
<view class="dayDataListBigBox" v-for="(item, index) in datas" :key="index">
item.xx循环渲染的数据
</view>
</scroll-view>

 

在方法中写

//触底加载数据
bottomOut() {
this.status = 'loading';//滑到底部的时候显示状态为加载中
this.page += 1;//请求页数+1
//判断没数据后停止请求接口数据,并修改显示状态为没有更多
if(this.page >= 6){
this.status = 'nomore';
return;
}
this.getDriverLogs();//调用数据请求
},

其问主要就是记录在scroll-view 中上拉触底加载数据问题

posted @ 2023-02-15 15:02  贪恋·  阅读(628)  评论(0)    收藏  举报