美文网首页
uni-app下拉刷新,上拉加载更多

uni-app下拉刷新,上拉加载更多

作者: 佑安丶 | 来源:发表于2023-12-06 15:07 被阅读0次

首先在pages.json里将enablePullDownRefresh改为true,这句是下拉刷新

我这里是做了个判断,当分页大于等于2页的时候才显示

// 上拉刷新当前页 onPullDownRefresh() { this.imitateList = []; this.page = 1; setTimeout(() => { // 调用接口 this.dataLists() // 关闭上拉刷新 uni.stopPullDownRefresh(); }, 1000) }, // 下拉加载更多 onReachBottom() { // console.log('下拉加载更多') if (this.page >= this.total) { this.status = 'nomore' return } else { this.status = 'loading' this.page = ++this.page; setTimeout(() => { // 调用接口 this.dataLists() }, 1000) } },

相关文章

网友评论

      本文标题:uni-app下拉刷新,上拉加载更多

      本文链接:https://www.haomeiwen.com/subject/ctujgdtx.html