当前位置:网站首页>微信小程序分页功能,下拉刷新功能,直接干货拿来就用
微信小程序分页功能,下拉刷新功能,直接干货拿来就用
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);
},
边栏推荐
- Oracle fundamentals summary
- 4~20mA输入/0~5V输出的I/V转换电路
- CAD secondary development +nettopologysuite+pgis reference multi version DLL
- Alert pop-up processing in Web Automation
- Socket. Io long Connection Push, version Control, Real - Time Active user volume Statistics
- RN7302三相电量检测(基于STM32单片机)
- Is it safe to open a stock account? How to open a stock account?
- FPGA - 7系列 FPGA SelectIO -08- 高级逻辑资源之OSERDESE2
- 报错--解决core-js/modules/es.error.cause.js报错
- JS of learning notes -- split(), replace(), join()
猜你喜欢

Caused by: com. fasterxml. jackson. databind. exc.InvalidDefinitionException: Cannot construct instance

Openharmony gnawing paper growth plan -- json-rpc

FPGA - 7 Series FPGA selectio -09- io of advanced logic resources_ FIFO

FPGA - 7系列 FPGA SelectIO -08- 高级逻辑资源之OSERDESE2

【网络教程】IPtables官方教程--学习笔记1

High quality domestic stereo codec cjc8988, pin to pin replaces wm8988

FPGA - 7系列 FPGA SelectIO -09- 高级逻辑资源之IO_FIFO

Freeswitch uses Mod_ Shot module plays mp3

Boost the rising point | yolov5 combined with alpha IOU

Promotion intégrale et ordre des octets de fin de taille
随机推荐
High quality domestic stereo codec cjc8988, pin to pin replaces wm8988
Deleting MySQL under Linux
记JPA使用自定义VO接收 JPQL查询结果
What is the e-commerce conversion rate so abstract?
三极管驱动无刷电机
Configure redis from 0
Paper recommendation: efficientnetv2 - get smaller models and faster training speed through NAS, scaling and fused mbconv
Caused by: com. fasterxml. jackson. databind. Exc.invalidformatexception: exception resolution
Uni app wechat applet sharing function
AutoCAD C polyline small acute angle detection
FPGA - 7系列 FPGA SelectIO -09- 高级逻辑资源之IO_FIFO
Exception handling (I) -- null pointer and array index out of bounds
Install redis on windows and permanently change the password, and integrate redis with the SSM framework
Build your jmeter+jenkins+ant
Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
阿里云短信服务(完整指南),短信发送功能实现。
freeswitch设置最大呼叫时长
Tryout title code
JSP
idea创建类时自动添加注释