微信小程序:下拉刷新

下拉刷新

1.需要在json文件中,设置"enablePullDownRefresh": true,表示该页面使用下拉刷新

2.在微信内置函数onPullDownRefresh中进行操作

onPullDownRefresh: function(){
console.log("onPullDownRefresh");
var that = this;
that.getPhotoInfo();
}

我这里的操作调用了其他的函数,不需要也可以在下面自定义函数。注意如果需要和后台交互等,可以在交互成功后结束掉下拉刷新----wx.stopPullDownRefresh(); //停止下拉刷新

原文地址:https://www.cnblogs.com/two-bees/p/10458198.html