当前位置:网站首页>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);
},
边栏推荐
- No one can only use foreach to traverse arrays, right?
- API learning of OpenGL (2006) glclientactivetexture
- How to open UMD, KMD log and dump diagrams in CAMX architecture
- Drop down list processing in Web Automation
- API learning of OpenGL (2007) gltexcoordpointer
- socke.io長連接實現推送、版本控制、實時活躍用戶量統計
- Socket. Io long Connection Push, version Control, Real - Time Active user volume Statistics
- Integer promotion and size side byte order
- [staff] arpeggio mark
- Deleting MySQL under Linux
猜你喜欢

Online facing such an online world, the only limitation is our imagination

Linked list (III) - reverse linked list

JDBC learning (I) -- implementing simple CRUD operations

Linux MySQL implements root user login without password

Interpretation of Blog

YOLOv5增加小目标检测层

MySQL (I) - Installation

Slow content advertising: the long-term principle of brand growth

Alert pop-up processing in Web Automation

Drop down list processing in Web Automation
随机推荐
freeswitch使用mod_shout模块播放mp3
【Paper Reading-3D Detection】Fully Convolutional One-Stage 3D Object Detection on LiDAR Range Images
Integer promotion and size side byte order
AutoCAD C# 多段線小銳角檢測
Yolact++ pytoch environment
AttributeError: 'callable_iterator' object has no attribute 'next'
Yolov5 adds a small target detection layer
Introduction to openscap
报错--解决core-js/modules/es.error.cause.js报错
RN7302三相电量检测(基于STM32单片机)
Floating and positioning
fpm工具安装
extern “C“概述
Paper recommendation: efficientnetv2 - get smaller models and faster training speed through NAS, scaling and fused mbconv
MySQL (I) - Installation
Build your jmeter+jenkins+ant
整型提昇和大小端字節序
整型提升和大小端字节序
基本类型和包装类的区别
Students who do not understand the code can also send their own token. The current universal dividend model can be divided into BSC and any generation B