微信触底懒加载

  data: {
    livehose: [],//接口数组
    page: 1,//根据后端要求返回相应页数
    more: false,//显示没有更多了哦
    call: 1,//接口没有数据返回就为1下次下拉不在调用接口
  },
  onLoad: function(options) {
    let that = this
    that.liveTv()
  },
  //获取列表数据接口
	liveTv() {
	    wx.showLoading({
	      title: '加载中',
	    })
	    let that = this
	   	api.wxRequest({
	        method: 'POST',
	        url: "app/notice/row",
	        data: {
	        }
	      }).then(res => {
	        if (res.data.other.room_info != "") {
	          let mide = that.data.page + 1
	          let arry = that.data.livehose.concat(res.data.other.room_info) //前提是livehose是数组
	          that.setData({
	            livehose: arry,
	            page: mide,
	            call: 0
	          })
	          console.log(that.data.livehose.length, '条数据')
	        } else {
	          that.setData({
	            call: 1,
	            more: true
	          })
	        }
	      })
		}
//到底加载API
onReachBottom: function() {
    console.log('到底了')
    let that = this
    if (that.data.call== 0) {
      that.liveTv()
    }
},

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值