当前位置:网站首页>Wechat applet paging function, pull-down refresh function, direct dry goods
Wechat applet paging function, pull-down refresh function, direct dry goods
2022-06-28 06:33:00 【Infatuated Arvin】
Recently I wrote a wechat applet , List rendering , Some paging is often used , The drop-down refresh , Pull up loading and other functions , Sum up , Wechat applet paging function , Pull down refresh function , Use the dry goods directly , Don't talk much , Liver palpation
Author's brief introduction :
I'm crazy about Arvin , Your brother Xueyou !
Personal home page : Infatuated with Arvin's blog
Preface of this paper : Wechat applet paging function , Pull down refresh function , Use the dry goods directly
If you think the blogger's article can help you , Please support the blogger
Go straight up , Paging function
// Pagination , Pull down load
getlist(page, types){
if (this[types == 10 ? 'lastPage':(types == 11?'lastPage2':'lastPage3')] && page != 0) return
this[types == 10 ? 'page' :(types == 11?'page2':'page3') ] += page
let page_json = {
page: types == 10 ? this.page += page : this.page2 += page,
rows: 10,
tagid: types
}
console.log('let page_json', page_json)
if (page == 0) {
uni.showLoading({
title: ' Loading '
})
}
const URL = getApp().globalData.appApi + '/gk/qrynewsbytagid'
this.$http.post_request(page_json, URL, res => {
console.log(' Query paging ', res)
uni.hideLoading()
if (types == 10) {
this.lastPage = res.model.lastPage
if (page == 0) {
this.hotnewslist = res.model.list
return
}
this.hotnewslist.push(...res.model.list)
} else if (types == 11) {
this.lastPage2 = res.model.lastPage
if (page == 0) {
this.realnewslist = res.model.list
return
}
this.realnewslist.push(...res.model.list)
}else if(types == 12){
this.lastPage3 = res.model.lastPage
if (page == 0) {
this.barContentList = res.model.list
return
}
this.barContentList.push(...res.model.list)
}
})
}, Pull on loading
// The drop-down refresh
onPullDownRefresh(){
if(this.tabIndex == 0){
this.getlist(0, 10);
return
}else if(this.tabIndex == 1){
this.getlist(0, 11);
return
}else if(this.tabIndex == 2){
this.getlist(0, 12);
return
}
setTimeout(function () {
uni.stopPullDownRefresh();
uni.showToast({
title:' Refresh successful ',
icon:'none',
duration:1500
})
}, 3000);
},
onShow() {
this.initData();
this.getlist(0, 10);
this.getlist(0, 11);
this.getlist(0, 12);
},
边栏推荐
猜你喜欢

Socket. Io long Connection Push, version Control, Real - Time Active user volume Statistics

Difficulty calculation of Ethereum classic

Rn7302 three-phase electric quantity detection (based on STM32 single chip microcomputer)

lombok @EqualsAndHashCode 注解如何让对象.equals()方法只比较部分属性

Drop down list processing in Web Automation

Linked list (I) - remove linked list elements

链表(一)——移除链表元素

三极管驱动无刷电机

ROS rviz_satellite功能包可视化GNSS轨迹,卫星地图的使用

YOLOv5增加小目标检测层
随机推荐
Freeswitch uses origin to dialplan
AutoCAD C# 多段线自相交检测
AutoCAD C# 多段線小銳角檢測
Build your jmeter+jenkins+ant
选拔赛题目代码
普歌 -- getOrDefault()方法理解
Idea automatically adds comments when creating classes
Shell script one click deployment (MySQL)
Configure redis from 0
Yygh-7-user management
AttributeError: 'callable_iterator' object has no attribute 'next'
FPGA - 7 Series FPGA selectio -08- oserdese2 of advanced logic resources
Caused by: com. fasterxml. jackson. databind. exc.InvalidDefinitionException: Cannot construct instance
代码没写错,渲染页面不显示原因
mysql常用函数
Triode driven brushless motor
MySQL (II) - basic operation
Linux MySQL implements root user login without password
API learning of OpenGL (2006) glclientactivetexture
Floating and positioning