微信小程序 – 关于下拉刷新

 1   // 拉取数据
 2   fetchData: function() {  3  wx.request({  4       url: ‘http://v.juhe.cn/toutiao/index‘,  5  data: {  6         type: ‘‘,  7         key: ‘482e213ca7520ff1a8ccbb262c90320a‘
 8  },  9  header: { 10         ‘contentType‘: ‘application/json‘
11  }, 12       success: function(res) { 13  console.log(res.data) 14  } 15  }); 16  }, 17 
18   // 下拉刷新
19   onPullDownRefresh: function() { 20     console.log(‘onPullDownRefresh‘, ‘下拉刷新....‘); 21     this.fetchData(); 22  wx.stopPullDownRefresh; 23   },

 

即重新调用请求数据…. 建议逻辑分开写

微信小程序 - 关于下拉刷新