【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 = '';
				}
			})
		},
}
相关推荐
iOS阿玮1 小时前
打个广告,帮忙招一个iOS开发的扛把子~
uni-app·app·apple
Cerrda2 小时前
🌟让你的uniapp应用拥有更现代的交互体验,一个支持滚动渐变透明的导航栏组件🌟
uni-app
2501_916007473 小时前
iOS 应用性能测试的工程化流程,构建从指标采集到问题归因的多工具协同测试体系
android·ios·小程序·https·uni-app·iphone·webview
00后程序员张6 小时前
iOS 抓不到包怎么办?从 HTTPS 解密、QUIC 排查到 TCP 数据流分析的完整解决方案
android·tcp/ip·ios·小程序·https·uni-app·iphone
前端互助会7 小时前
UNI-APP开发APP避坑指南:这些关键事项你必须掌握
uni-app
游戏开发爱好者81 天前
iOS 商店上架全流程解析 从工程准备到审核通过的系统化实践指南
android·macos·ios·小程序·uni-app·cocoa·iphone
toooooop81 天前
Vuex 中 state、mutations 和 actions 的原理和写法
前端·javascript·uni-app
林_xi1 天前
uniapp使用@uni-ku/root插件实现全局组件
前端·uni-app
计算机毕设定制辅导-无忧学长1 天前
基于uni-app的“民族风韵”特色购物小程序
uni-app
一个处女座的程序猿O(∩_∩)O1 天前
UniApp 生命周期全解析:从应用到页面,再到组件的完美协奏曲
前端·uni-app