当前位置:网站首页>More loading in applets (i.e. list paging)
More loading in applets (i.e. list paging)
2022-07-28 19:08:00 【Li & Xuan】
1.app.json in :
"window": {
"enablePullDownRefresh": true // Whether to open the current page drop-down refresh
}2.wxml in :
<view class="info" wx:for="{
{contentlist}}" wx:key="key">
<input hidden="{
{hidden}}" value="{
{item.id}}"/>
<text>{
{item.title}}</text>
<text class="time">{
{item.inputtime}}</text>
<view>
<text>{
{item.content}}</text>
</view>
</view>3.js in :
data: {
hidden: true, // Hide form controls
page: 1, // What page is the current request data
pageSize: 10, // Number of data bars per page
hasMoreData: true, // Whether to continue to request data when pulling , That is, whether there is more data
contentlist: [], // List of data obtained , Add it as an addition
},
// Get paging list
getInfo: function (message) {
var that = this;
wx.showNavigationBarLoading() // Display the navigation bar loading animation on the current page
wx.showLoading({ // Show loading Prompt box
title: message,
})
wx.request({
url: 'http://localhost:88/wechat/test.php', // The local setting does not verify the legal domain name
data: { page: that.data.page, count: that.data.pageSize },
method: 'post',
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: function (res) {
var contentlistTem = that.data.contentlist;
if (res.data.length > 0) {
wx.hideNavigationBarLoading() // Hide the navigation bar in the current page to load animation
wx.hideLoading() // hide loading Prompt box
if (that.data.page == 1) {
contentlistTem = []
}
var contentlist = res.data;
if (contentlist.length < that.data.pageSize) {
that.setData({
contentlist: contentlistTem.concat(contentlist),
hasMoreData: false
})
} else {
that.setData({
contentlist: contentlistTem.concat(contentlist),
hasMoreData: true,
page: that.data.page + 1
})
}
}
},
fail: function (res) {
wx.hideNavigationBarLoading()
wx.hideLoading()
fail()
},
complete: function (res) {
},
})
},
/**
* Life cycle function -- Listening page first rendering completed
*/
onLoad: function (options) {
// Page initialization options Parameters for page Jump
var that = this
that.getInfo(' Loading data ...')
},
/**
* Page related event handler -- Monitor user pull-down action
*/
onPullDownRefresh: function () {
this.data.page = 1
this.getInfo(' Refreshing data ')
},
/**
* Handling function of page pull bottom event
*/
onReachBottom: function () {
if (this.data.hasMoreData) {
this.getInfo(' Load more data ')
} else {
wx.showToast({
title: ' No more data ',
})
}
},
Reference resources : Load more in wechat applet ( List paging )_ Gaze under the night sky -CSDN Blog _ Wechat applet loads more
边栏推荐
- 直播平台软件开发,js实现按照首字母排序
- How much is software testing training generally?
- kotlin:out in
- Mongodb initialization
- How big is it suitable for learning software testing?
- Remember a uniapp experience
- 112. Use the self-developed proxy server to solve the cross domain access error encountered when uploading files by SAP ui5 fileuploader
- How to solve the problem that the win11 computer camera cannot be seen when it is turned on and the display screen is black?
- 4 年后,Debian 终夺回“debian.community”域名!
- A priori, a posteriori, likelihood
猜你喜欢

LeetCode_ 63_ Different paths II

cv5200无线WiFi通信模块,视频图像传输无线化,实时无线通信技术

【图像分割】基于方向谷形检测实现静脉纹路分割附MATLAB代码

湖上建仓全解析:如何打造湖仓一体数据平台 | DEEPNOVA技术荟系列公开课第四期

什么样的知识付费系统功能,更有利于平台与讲师发展?

JVM four reference types

QT & OpenGL lighting

112. Use the self-developed proxy server to solve the cross domain access error encountered when uploading files by SAP ui5 fileuploader

Introduction and advanced level of MySQL (I)

SwiftUI 组件之如何实现电话号码掩码隐藏部分的文本字段TextField(教程含源码)
随机推荐
Why app uses JSON protocol to interact with server: serialization related knowledge
Swiftui component how to implement textfield of hidden part of phone number mask (tutorial includes source code)
Introduction and advanced level of MySQL (II)
Differences between RDB and AOF for redis persistence
How long does software testing take?
Kotlin:Sealed class密封类详解
The wechat installation package has expanded 575 times in 11 years, and the up owner: "98% of the documents are garbage"; Apple App store was exposed to a large number of pornographic apps; Four techn
How to adjust the brightness of win11? Four methods of adjusting screen brightness in win11
kotlin:out in
[actual combat] realize page distortion correction with OpenCV
One Hot编码是什么?为什么要用它,什么时候用它?
3、 Uni app fixed or direct to a certain page
Haproxy implements proxy configuration
GC garbage collector details
kotlin:Nothing
SQL custom automatic calculation
LeetCode_ 96_ Different binary search trees
CTR click through rate prediction practice project of advertising recommendation!
OAI L3 and L2 interface analysis
When unity customizes the editor, let the subclass inherit the inspector display effect of the parent class