当前位置:网站首页>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
边栏推荐
- Redis cache avalanche, penetration, breakdown, bloom filter, detailed explanation of distributed lock
- Use the self-developed proxy server to solve the cross domain access errors encountered when uploading files by SAP ui5 fileuploader trial version
- 什么样的知识付费系统功能,更有利于平台与讲师发展?
- How to write a JMeter script common to the test team
- Swiftui component how to implement textfield of hidden part of phone number mask (tutorial includes source code)
- Redis advantages and data structure related knowledge
- Easynlp Chinese text and image generation model takes you to become an artist in seconds
- 关于ASM冗余问题
- Structure and working principle of thyristor
- LeetCode_ 343_ integer partition
猜你喜欢

Easynlp Chinese text and image generation model takes you to become an artist in seconds

Open source database innovation in the era of digital economy | the 2022 open atom global open source summit database sub forum was successfully held

My creation anniversary -- July 25th, 2022

How to solve the problem that easycvr device cannot be online again after offline?

数字经济时代的开源数据库创新 | 2022开放原子全球开源峰会数据库分论坛圆满召开

Four years later, Debian finally recaptured the "debian.community" domain name!

Zero knowledge proof: zkp with DDH assumption
![[GXYCTF2019]StrongestMind](/img/f4/61932548e0c7dd60d790d31fb5b96b.png)
[GXYCTF2019]StrongestMind

Introduction and advanced MySQL (III)

3、 Uni app fixed or direct to a certain page
随机推荐
How to break through the bottleneck of professional development for software testing engineers
[actual combat] realize page distortion correction with OpenCV
Xiaobai must see the development route of software testing
Win11怎么调亮度?Win11调屏幕亮度的四种方法
【雷达】基于核聚类实现雷达信号在线分选附matlab代码
2022 Niuke multi School Game 2 J. link with arithmetic progress (three points + enumeration)
Use the self-developed proxy server to solve the cross domain access errors encountered when uploading files by SAP ui5 fileuploader trial version
When unity customizes the editor, let the subclass inherit the inspector display effect of the parent class
2022年牛客多校第2场 J . Link with Arithmetic Progression (三分+枚举)
How to write a JMeter script common to the test team
Is it useful to learn software testing?
数字经济时代的开源数据库创新 | 2022开放原子全球开源峰会数据库分论坛圆满召开
JVM four reference types
[GXYCTF2019]StrongestMind
QT & OpenGL lighting
关于ASM冗余问题
Introduction and advanced MySQL (7)
【物理应用】大气吸收损耗附matlab代码
【滤波跟踪】基于EKF、时差和频差定位实现目标跟踪附matlab代码
【实战】用OpenCV实现页面扭曲矫正