当前位置:网站首页>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
边栏推荐
- How to adjust the brightness of win11? Four methods of adjusting screen brightness in win11
- What kind of knowledge payment system functions are more conducive to the development of the platform and lecturers?
- [GXYCTF2019]StrongestMind
- UE4.25 Slate源码解读
- How big is it suitable for learning software testing?
- Is there a future for changing careers in learning software testing?
- Today in history: Microsoft acquires qdos; Model testing pioneer birth; The first laser typesetting Chinese newspaper
- 2022年牛客多校第2场 J . Link with Arithmetic Progression (三分+枚举)
- 行业落地呈现新进展 | 2022开放原子全球开源峰会OpenAtom OpenHarmony分论坛圆满召开
- Meta Q2 earnings: revenue fell for the first time, and metaverse will compete with apple
猜你喜欢

LeetCode_ 96_ Different binary search trees

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

LeetCode_ 63_ Different paths II

Decimal to binary advanced version (can convert negative numbers and boundary values)

The switching language of unity causes an error: system FormatException:String was not recognized as a valid DateTime.

Introduction and advanced MySQL (III)

My creation anniversary -- July 25th, 2022

New progress in the implementation of the industry | the openatom openharmony sub forum of the 2022 open atom global open source summit was successfully held

Why did wechat change from "small and beautiful" to "big and fat" when it expanded 575 times in 11 years?

Introduction and advanced MySQL (7)
随机推荐
行业落地呈现新进展 | 2022开放原子全球开源峰会OpenAtom OpenHarmony分论坛圆满召开
Cause analysis and solution of video jam after easycvr is connected to the device
When unity customizes the editor, let the subclass inherit the inspector display effect of the parent class
Redis cache avalanche, penetration, breakdown, bloom filter, detailed explanation of distributed lock
When the new version of easycvr is linked at the same level, the subordinate platform passes up the cause analysis of the incomplete display of the hierarchical directory
Meta Q2 earnings: revenue fell for the first time, and metaverse will compete with apple
湖上建仓全解析:如何打造湖仓一体数据平台 | DEEPNOVA技术荟系列公开课第四期
什么样的知识付费系统功能,更有利于平台与讲师发展?
【图像隐藏】基于DCT、DWT、LHA、LSB的数字图像信息隐藏系统含各类攻击和性能参数附matlab代码
How to solve the problem that the win11 computer camera cannot be seen when it is turned on and the display screen is black?
N32替换STM32,这些细节别忽略!
GC garbage collector details
@The difference between Autowired and @resource
EasyCVR设备离线后无法再次上线该如何解决?
Interpretation of ue4.25 slate source code
QT with line encoding output cout
【数据分析】基于MATLAB实现SVDD决策边界可视化
How does the mqtt server built with emqx forward data and save it to the cloud database?
直播平台软件开发,js实现按照首字母排序
Unity 之 切换语言导致报错:System.FormatException:String was not recognized as a valid DateTime.