微信小程序-下拉松开弹不回去顶部留一段空白

解决办法:

  空白的出现有可能是多次触发下拉事件导致请求过多导致页面反应延迟。

  在 onPullDownRefresh 事件里加setTimeout事件延迟下下拉刷新的事件。

  /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh();
    let _This = this;
    let oUInfo = _This.data.oUInfo;
    (!oUInfo.unionId) && getApp().getUserData(function (result) {
      _This.fGetCUserInfo(result.unionId);
      _This.setData({
        oUInfo: result
      });
    });
    setTimeout(function () {
   // 这里写刷新要调用的函数,比如: _This.pullRefresh(); }, 500); },

  

  注意,setTimeout要写在getApp请求之后,setTimeout只处理刷新后数据的获取。间隔时间建议为500。

 

posted @ 2018-04-24 11:16  Jaye8584  阅读(6133)  评论(1编辑  收藏  举报