在json 文件中 加
“enablePullDownRefresh”: true
在wxss文件中 加 背景颜色 不然没有下拉小点点
page{
background-color: #颜色;
}
在 js中 加方法
onPullDownRefresh() {
var that = this;、
var url = ‘一个地址’
wx.showNavigationBarLoading() //在标题栏中显示加载
wx.request({
url: url,
method: 'post',
header: {
'content-type': 'application/json'
},
success: function (res) {
that.setData({
刷新存值
})
},
fail: function (err) {
console.log("sssssssssssss" + err.data);
},
complete: function() {
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
}
})
}