当前位置:网站首页>微信小程序分页功能,下拉刷新功能,直接干货拿来就用
微信小程序分页功能,下拉刷新功能,直接干货拿来就用
2022-06-28 06:26:00 【痴心阿文】
最近写微信小程序,列表渲染啥的,经常用到一些分页,下拉刷新,上拉加载等功能,总结整理一下,微信小程序分页功能,下拉刷新功能,直接干货拿来就用,话不多说,肝着
作者简介:
我是痴心阿文,你们的学友哥!
个人主页:痴心阿文的博客
本文前言:微信小程序分页功能,下拉刷新功能,直接干货拿来就用
如果觉得博主的文章有帮到你的话,请支持一下博主哦
直接上,分页功能
//分页,下拉加载
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: '加载中'
})
}
const URL = getApp().globalData.appApi + '/gk/qrynewsbytagid'
this.$http.post_request(page_json, URL, res => {
console.log('查询分页啊', 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)
}
})
},上拉加载
//下拉刷新
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:'刷新成功',
icon:'none',
duration:1500
})
}, 3000);
},
onShow() {
this.initData();
this.getlist(0, 10);
this.getlist(0, 11);
this.getlist(0, 12);
},
边栏推荐
- Caused by: com. fasterxml. jackson. databind. exc.InvalidDefinitionException: Cannot construct instance
- How the third-party libraries in cocoapod reference local header files
- 重载,重写的区别,抽象类,接口的区别
- Object object to list collection
- death_satan/hyperf-validate
- Linux Mysql 实现root用户不用密码登录
- Oracle condition, circular statement
- 手把手教你用Ucos
- How popular are FB and WhatsApp mass messages in 2022?
- YYGH-BUG-03
猜你喜欢

Interpretation of Blog

Difficulty calculation of Ethereum classic

异常处理(一)——空指针和数组索引越界

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

socke.io长连接实现推送、版本控制、实时活跃用户量统计

What is the e-commerce conversion rate so abstract?

Paper recommendation: efficientnetv2 - get smaller models and faster training speed through NAS, scaling and fused mbconv

Lombok @equalsandhashcode annotation how to make objects The equals () method compares only some attributes

CAD secondary development +nettopologysuite+pgis reference multi version DLL

Use of JDBC
随机推荐
idea根据数据库表生成实体类
Differences between basic types and packaging classes
Select trigger event from easyUI drop-down box
FPGA - 7 Series FPGA selectio -07- iserdese2 of advanced logic resources
JQ picture amplifier
Working principle of es9023 audio decoding chip
Xcode13.3.1 error reported after pod install
Build your jmeter+jenkins+ant
Scripting and programming languages
记JPA使用自定义VO接收 JPQL查询结果
Note that JPA uses a custom VO to receive jpql query results
freeswitch设置最大呼叫时长
Yolact++ pytoch environment
YYGH-BUG-02
Alibaba cloud SMS service (Complete Guide), SMS sending function implementation.
Boost the rising point | yolov5 combined with alpha IOU
助力涨点 | YOLOv5结合Alpha-IoU
idea创建类时自动添加注释
Small ball playing
ThreadLocal