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()
}
},
微信触底懒加载
最新推荐文章于 2024-07-10 18:53:50 发布