赞
踩
微信小程序开发系列
在开发微信小程序中经常会需要下拉页面进行更新要页面数据的功能,微信小程序提供了onPullDownRefresh函数。该函数作用是监听用户下拉动作。
监听用户下拉刷新事件。
"enablePullDownRefresh": true
{
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": true,//开启下拉刷新
"backgroundTextStyle": "dark",
"usingComponents": {
}
}
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
wx.showLoading({
title: '刷新中...',
})//加载中
this.getOrderDetail(this);//业务处理
},
getOrderDetail: function (e) {
var that = e;
var id= that.data.id;
var params = {
url: "/getOrderDetail",
method: "POST",
data: {
"id":this.data.id
},
callBack: function (res) {
//设置数据
wx.hideLoading();
wx.stopPullDownRefresh();//停止下拉刷新效果
}
};
http.request(params);
},
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。