【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 = '';
				}
			})
		},
}
相关推荐
军军君014 小时前
基于Springboot+UniApp+Ai实现模拟面试小工具四:后端项目基础框架搭建下
spring boot·spring·面试·elementui·typescript·uni-app·mybatis
小徐_23339 小时前
uni-app 弹窗总被父元素“绑架”?3招破局,H5/小程序/APP一招通杀!
前端·微信小程序·uni-app
Java陈序员15 小时前
又一款基于 SpringBoot + Vue 实现的开源新零售商城系统!
vue.js·spring boot·uni-app
2501_915921431 天前
没有Mac如何完成iOS 上架:iOS App 上架App Store流程
android·ios·小程序·https·uni-app·iphone·webview
玩代码的菜鸟1 天前
uniapp类似抖音视频滑动
uni-app
默魔2 天前
uniapp 微信小程序点击开始倒计时
微信小程序·小程序·uni-app
shmily ....2 天前
医疗预约系统中的录音与图片上传功能实现:Vue3+Uniapp 实战
uni-app
小阿技术2 天前
uniapp制作一个个人页面
uni-app
小阿技术2 天前
uniapp制作一个视频播放页面
uni-app
小周同学:2 天前
uni-app获取手机当前连接的WIFI名称
智能手机·uni-app