• 小程序开发----微信小程序实现下拉刷新功能


    微信小程序实现下拉刷新功能

    1.json文件配置属性enablePullDownRefresh

      

    1    {
    2     "enablePullDownRefresh": true
    3   }    
      
     

    2.js中调用刷新函数

     1    /**
     2    * 获取数据
     3    */
     4   getlist() {
     5     //业务逻辑...(省略)
     6     
     7     //隐藏loading 提示框
     8     wx.hideLoading();
     9     //隐藏导航条加载动画
    10     wx.hideNavigationBarLoading();
    11     //停止下拉刷新
    12     wx.stopPullDownRefresh();
    13   },
    14 
    15    /**
    16    * 刷新
    17    */
    18   onRefresh:function(){
    19     //导航条加载动画
    20     wx.showNavigationBarLoading()
    21     //loading 提示框
    22     wx.showLoading({
    23       title: 'Loading...',
    24     })
    25     this.getlist();
    26   },
    27 
    28   /**
    29    * 页面相关事件处理函数--监听用户下拉动作
    30    */
    31   onPullDownRefresh: function () {
    32     this.onRefresh();
    33   }

    最终结果:

  • 相关阅读:
    PAT 1053 住房空置率
    PAT 1078 字符串压缩与解压
    PAT 1024 科学计数法
    HDU 2078 复习时间
    HDU 2065 "红色病毒"问题
    网络协议分析
    多线程同步
    多线程程序设计
    消息队列通讯
    共享内存通讯
  • 原文地址:https://www.cnblogs.com/chocolatexll/p/13182941.html
Copyright © 2020-2023  润新知