1 个回答

自定义刷新

https://developers.weixin.qq.com/miniprogram/dev/component/sc...
已支持 scroll-view 自定义下拉刷新,需自定义的,建议通过 scroll-view 的方式实现
链接最下方:
image.png

api做刷新

在页面的json文件中添加设置:
“enablePullDownRefresh”: true
也就是写成下面这样子:

{             
  "usingComponents": {},
  "enablePullDownRefresh": true
}

js文件中写一个onRefresh()生命周期:

onRefresh:function(){
    //导航条加载动画
    wx.showNavigationBarLoading()
    //loading 提示框
    wx.showLoading({
      title: 'Loading...',
    })
    console.log("下拉刷新啦");
    setTimeout(function () {
      wx.hideLoading();
      wx.hideNavigationBarLoading();
      //停止下拉刷新
      wx.stopPullDownRefresh();
    }, 2000)
  },

在onPullDownRefresh()中调用上面写的函数:

/**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh:function(){
    this.onRefresh();
  },
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题