【uniapp小程序-上拉加载】


在需要上拉加载的页面的page.json上添加红框框里面的

js 复制代码
onReachBottom() {
	if(this.commentCurrent<this.commentTotal){
		this.commentCurrent += 1;	
		this.commentList();
		this.status = 'loading';
	}else{
		this.status = '';
	}
},
methods:{
	commentList(){
			let params = {
				courseid:this.courseid,
				page:this.commentCurrent
			}
			commentList(params).then((res)=>{
				let {code,list,numpage} = res
				if(code==0){
					//如果页数>1,需要拼接返回的数据
					if (this.commentCurrent > 1) {
						list = [...this.commentData, ...list];
					}
					this.commentData = list
					this.commentTotal = numpage
					uni.stopPullDownRefresh(); //拿到数据后,停止下拉刷新
					this.status = '';
				}
			})
		},
}
相关推荐
PedroQue9912 小时前
uni-router v2.0.0:四大功能拆分为插件,按需加载
前端·uni-app
不法1 天前
uniapp map地图导航/地图路线
前端·vue.js·uni-app
淡淡的幼稚2 天前
【YFIOs】从传感芯片到表格曲线
uni-app·.net
宠友信息2 天前
多端即时通讯源码技术实践,Redis路由、MySQL持久化与Socket接入
spring boot·websocket·mysql·uni-app
宠友信息2 天前
Spring Boot与异步审核构建仿小红书源码内容发布全流程
java·数据库·spring boot·redis·mysql·oracle·uni-app
蜡台2 天前
uniapp vue2 转 vue3
前端·javascript·uni-app·vue3·vue2
2501_916008893 天前
iOS 证书管理最佳实践 从创建到续期的完整指南
android·ios·小程序·https·uni-app·iphone·webview
敖行客 Allthinker3 天前
UniApp iOS APNs 推送证书一站式配置
uni-app·mac
梦曦i3 天前
uni-router新推useUniEventChannel,彻底解决页面通信难题
前端·uni-app
宠友信息3 天前
内容社区源码多端数据协议与 Spring Boot 状态流转实现思路
java·spring boot·websocket·uni-app