创建时间:2018-06-21
xxx.json 文件中开启下拉刷新
"enablePullDownRefresh":true
代码
<script>
Page({
data: {},
onPullDownRefresh() {
console.log("--------下拉刷新-------");
wx.showNavigationBarLoading(); //在标题栏中显示加载
var that = this; //请求
wx.request({
url: "https://xxx", //请求地址
data: {},
header: {
"content-type": "application/json", // 默认值
},
success: function (res) {
console.log(res.data);
},
complete: function () {
// complete
wx.hideNavigationBarLoading(); //完成停止加载
wx.stopPullDownRefresh(); //停止下拉刷新
},
});
},
});
</script>