当前位置:网站首页>Wechat applet (pull-down refresh data) novice to
Wechat applet (pull-down refresh data) novice to
2022-06-13 06:11:00 【Vue sauce】
Record a small problem that bothers you , Also give you a reference ~
When doing your own personal applet project , You need to implement the user pull-down refresh data , Read a lot of tutorials , They're all talking scroll-view To achieve , But I don't have high requirements for style , Just use the one that comes with wechat ~
To achieve the effect of :
1, If you need to implement pull-down refresh globally , Can be in app.json file ,window Configure and enable pull-down refresh , Only oneortwo pages don't need to be refreshed by pull-down , It's on the page json File configuration , Turn off pull-down refresh
Turn on global pull-down refresh ----->
app.json:
{
"window": {
//json The file cannot be commented , But for the convenience of explanation, it is written here ,
"backgroundTextStyle": "dark", //backgroundTextStyle Support only dark / light, If set to light The loading animation of the three points is the same as the background color
"enablePullDownRefresh": true
}
}
Local close pull-down refresh ----->
index.json:
{
"enablePullDownRefresh": false
}
Similarly, only oneortwo pages need to be refreshed , On the page of the page json File configuration , Start the pull-down refresh
2, The refresh data
Wechat will be triggered when we pull down the top onPullDownRefresh function , Here we can re request data
index.js:
async onPullDownRefresh(){
const res=await wx.request({
url: xxx,
method:xxx,
data: xxx
})
// When the request is complete, we need to call wx.stopPullDownRefresh() Stop refreshing , Drop down window bounce
wx.stopPullDownRefresh()
}
summary : If the style requirements are not high , In this way, the effect can be achieved . stay onPullDownRefresh Function USES async An asynchronous function , Wait for the data to return , See my other articles for specific methods of requesting background data !
边栏推荐
- 【ONE·Data || 带头双向循环链表简单实现】
- Rk3399 hid gadget configuration
- High burst solution 2
- Detailed explanation of Yanghui triangle
- [var const let differences]
- Echart柱状图:堆叠柱状图value格式化显示
- Essays on November 5, 2021
- DLL bit by bit
- 华为开发者认证与DevEco Studio编译器下载
- Not in the following list of legal domain names, wechat applet solution
猜你喜欢
随机推荐
Leetcode perfect number simple
USB debugging assistant
Echart折线图:多条折线图每次仅展示一条
The difference between the increment and decrement operators before and after variables i+, +i, I –, – I
Leetcode guessing numbers game - simple
[DP 01 backpack]
Leetcode- find all missing numbers in the array - simple
Introduction to USB learning (I) -- Dongfeng night flower tree
Kotlin learning notes (1)
Wechat applet: click the event to obtain the current device information (basic)
Ffmpeg download suffix is Video files for m3u8
Leetcode- longest continuous increasing sequence - simple
Leetcode- maximum average of subarray i- simple
Turn to 2005
Leetcode- keyboard line - simple
Leetcode- longest palindrome string - simple
js-bom
微信小程序:全局状态变量的使用
Echart柱状图:堆叠柱状图value格式化显示
Leetcode- string addition - simple






![[DP 01 backpack]](/img/be/1e5295684ead652eebfb72ab0be47a.jpg)


