当前位置:网站首页>Wechat applet pull-down refresh function --onpulldownrefresh
Wechat applet pull-down refresh function --onpulldownrefresh
2022-07-18 16:51:00 【Front end dish daydayup】
Mentioned the pull-down refresh of wechat applet , We may think of <scroll-view> Pull down refresh event in , Obviously, this is only satisfied with <scroll-view> Components . Let's have a look first onPullDownRefresh Pull down refresh function . For details, see uni-app Official website .
onPullDownRefresh
stay js In the definition of onPullDownRefresh Processing function ( and onLoad And so on ), Listen for the user pull-down refresh event on this page .
- Need to be in
pages.jsonin , Of the current page found pages node , And instyleOption onenablePullDownRefresh.- When the data is refreshed after processing ,
uni.stopPullDownRefreshYou can stop the pull-down refresh of the current page .
uni.startPullDownRefresh(OBJECT)
Start pull-down refresh , Trigger the pull-down to refresh the animation after calling , The effect is the same as the user's manual pull-down refresh .
uni.stopPullDownRefresh()
Stop the current page drop-down refresh .
Example :
pages.json
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app",
"enablePullDownRefresh": true
}
}
],
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#0faeff",
"backgroundColor": "#fbf9fe"
}
}index.vue
// Just for example , In the actual development, the delay is used according to the demand .
export default {
data() {
return {
text: 'uni-app'
}
},
onLoad: function (options) {
setTimeout(function () {
console.log('start pulldown');
}, 1000);
uni.startPullDownRefresh();
},
onPullDownRefresh() {
console.log('refresh');
setTimeout(function () {
uni.stopPullDownRefresh();
}, 1000);
}
}My use in redevelopment :
onLoad() {
this.goodsList = [];
const page = {
curPage: 1,
pageSize: 10
}
this.page = page;
uni.startPullDownRefresh();
this.getGoodsList(page);
this.getSwiper();
},
// The drop-down refresh
onPullDownRefresh() {
this.goodsList = [];
const page = {
curPage: 1,
pageSize: 10
}
this.page = page;
this.getGoodsList(page);
setTimeout(function () {
uni.stopPullDownRefresh();
}, 1500);
},边栏推荐
- [QNX hypervisor 2.2 user manual]8.2 guest exit
- Apple商业网站封锁Firefox浏览器
- SAP Fiori Launchpad 上看不到任何 tile 应该怎么办?
- What happens from URL input to page presentation?
- “光”看新华三就够了: 园区如何进行全光技术选型-下篇
- Use flutter to make a beating heart
- "Light" is enough to see Xinhua III: how to select all-optical technology in the park - Part 2
- 微信小程序下拉刷新功能--onPullDownRefresh
- AP统计学
- AC管理
猜你喜欢

【深度学习】4 万字笔记!Yann LeCun 深度学习公开课 125 页干货都在这了

Scala 基础 (二):变量和数据类型

【今天的小go同学要去丢垃圾(1)】

Best practice path for problem solving

Bill Gates is about to withdraw from the world's rich list by donating $20billion!

【刷题记录】12. 整数转罗马数字

【分享】二层交换和三层交换转发

INSET: Sentence Infilling with INter-SEntential Transformer

UE4 blueprint learning chapter (6) -- branch, switch, filpflop, sequence

【古月21讲】ROS入门系列(3)——客户端Client、服务器Server的编程实现+自定义服务数据编程实现
随机推荐
Block的底层实现
面试官:怎么不用定时任务实现关闭订单?
Aardio - [library] graphical paging component library
反向加薪,这是什么操作?
Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return
JESD204B调试笔记(实用版)
OPPO、一加将在德国禁售?原来是被“专利流氓”诺基亚盯上了!
Apple商业网站封锁Firefox浏览器
module ‘urllib‘ has no attribute ‘urlretrieve‘
用 Flutter 来一颗跳动的心
[deep learning] 40000 word notes! Yann Lecun deep learning open class 125 pages of dry goods are here
Modern personal blog system modstartblog v5.3.0 message interface added, rich text upgrade
Web APIs DOM event flow
10张图教你同步与异步(转载)
Self signed SSL Certificate creation and use
Is the PMP certificate useful?
The position of limit n in PgSQL in SQL statement
Jitsi manu install (III)
“光”看新华三就够了: 园区如何进行全光技术选型-下篇
Search - binary sort tree (2)