【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 = '';
				}
			})
		},
}
相关推荐
夏碧笔12 小时前
uni-app跨端地图实战:用第三方LBS替代微信平台收费服务
uni-app
用户6990304848755 天前
try catch使用场景 处理同步代码错误兼容用的
javascript·uni-app
ITKEY_5 天前
uniapp微信开发者工具 更改AppID失败 touristappid
uni-app
Geek_Vison6 天前
APP瘦身实战:从80MB+砍到15MB——基于小程序容器技术剥离APP非核心业务的实践分享
小程序·uni-app·mpaas
CHB6 天前
HDC2026 演讲实录|AI 驱动的跨端进化:利用 uni-agent 快速构建高性能鸿蒙应用
uni-app·harmonyos
2501_915918416 天前
iOS App性能测试工具的实现方法与优化循环指南
android·ios·小程序·https·uni-app·iphone·webview
斯内普吖6 天前
(开源)高校素拓分管理系统小程序实战指南 基于 Java + SpringBoot + uni-app + Vue + MySQL
java·spring boot·mysql·小程序·uni-app·开源
海阔天空66887 天前
uniapp开启调试模式
uni-app·uniapp开启调试模式
anyup7 天前
分享 5 套 uni-app 实用主题,一键适配暗黑模式
前端·uni-app·视觉设计
gg159357284607 天前
Uni-app跨平台开发全解课程:从零基础到企业级多端落地实战
vue.js·uni-app