目录

微信小程序-下拉刷新

效果

实现步骤

一、在 Page 页面中的 json 文件中新增配置:

"enablePullDownRefresh": true,

二、在 Page 页面中的 js 文件中增加代码:

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.showNavigationBarLoading() //在标题栏中显示加载
    wx.showLoading({
      title: '刷新中...',
    })
    //模拟加载
    setTimeout(function()
    {
      // complete
      wx.hideNavigationBarLoading() //完成停止加载
      wx.stopPullDownRefresh() //停止下拉刷新
      wx.hideLoading(); //完成刷新中的提示
    },1500);
  },

以上即可实现微信小程序下拉刷新效果。


上一篇:«

下一篇: »


评论


Warning: Undefined variable $req in /www/wwwroot/wxzzz.com/wp-content/themes/quirk-wordpress-theme-master/functions.php on line 232

Warning: Undefined variable $commenter in /www/wwwroot/wxzzz.com/wp-content/themes/quirk-wordpress-theme-master/functions.php on line 233

Warning: Trying to access array offset on value of type null in /www/wwwroot/wxzzz.com/wp-content/themes/quirk-wordpress-theme-master/functions.php on line 233

Warning: Undefined variable $aria_req in /www/wwwroot/wxzzz.com/wp-content/themes/quirk-wordpress-theme-master/functions.php on line 233

Warning: Undefined variable $req in /www/wwwroot/wxzzz.com/wp-content/themes/quirk-wordpress-theme-master/functions.php on line 236

Warning: Undefined variable $commenter in /www/wwwroot/wxzzz.com/wp-content/themes/quirk-wordpress-theme-master/functions.php on line 237

Warning: Trying to access array offset on value of type null in /www/wwwroot/wxzzz.com/wp-content/themes/quirk-wordpress-theme-master/functions.php on line 237

Warning: Undefined variable $aria_req in /www/wwwroot/wxzzz.com/wp-content/themes/quirk-wordpress-theme-master/functions.php on line 238

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注