getHotStatusesRecommend() {
wx.showLoading({
title: ‘加载中’,
})
let that = this
Http.request({
url: ‘请求接口的地方’,
method: ‘POST’,
data: {
这里是接口所需要的必须参数
},
loading: false
}).then(result => {
const { data: res } = result
console.log(“热文推荐”, res)
if (res.data.statuses_list != ‘’) { //这里是接口返回的数据
let mide = that.data.page + 1
let arry = that.data.BAlist.concat(res.data.statuses_list)
that.setData({
BAlist: arry,
page: mide, //page是data里定义的 为0
call: 0 // data定义的数据为1
})
console.log(that.data.BAlist.length, ‘条数据’)
} else {
that.setData({
call: 1,
more: true
})
}
}
)
},
onReachBottom: function () {
var that = this;
console.log(“到底了”)
if (that.data.call == 0) { 当call为0 的时候就是显示到底了 重新再拉取接 口请求数据
that.getHotStatusesRecommend() / / onload定义的请求接口
}