美文网首页
微信小程序

微信小程序

作者: 幻想无极 | 来源:发表于2018-11-16 12:50 被阅读8次

数组

concat不改变当前数组,添加可添加数组
push,改变当前数组,可添加元素

上拉刷新下拉加载

1.json中添加"enablePullDownRefresh": true
则会在相应的js文件中触发

  onReachBottom() {
    console.log('上拉加载更多');
    var _this = this;
    var array = _this.data.pageData;
    var array1 = array.concat(_this.data.pageData);
    console.log(array)
    _this.setData({
      pageData: array1
    });
  },
  onPullDownRefresh() {
    console.log('下拉刷新');
    // wx.showNavigationBarLoading() //在标题栏中显示加载
    wx.stopPullDownRefresh();
  },

详情返回后刷新数据

 //从详细页面返回时会刷新
  onShow: function () {
    if (this.data.themeId == -1) {
      var pageData = wx.getStorageSync('pageData') || []
      this.setData({
        pageData: pageData
      })
    }
  },

相关文章

网友评论

      本文标题:微信小程序

      本文链接:https://www.haomeiwen.com/subject/ocfdoftx.html