思想:
1、通过请求start和limit 完成请求数据
2、每次触底获取区间数据
3、把请求的数据拼接在一起
* 页面上拉触底事件的处理函数
*/
gender 性别排行(male)
type 排行类型(hot)
major 大类
minor 小类
start 分页开始
limit 分页结束
onReachBottom: function () {
this.setData({
start: this.data.limit,
limit: this.data.limit + 20
})
//发送的请求
api.getCatsBooks(this.data.gender, this.data.typeList[this.data.show].id,
this.data.type, this.data.minor[this.data.show1], this.data.start, this.data.limit).then(res => {
this.setData({
//数据拼接 重点
bookdata: this.data.bookdata.concat(res.books)
})
console.log('书籍信息', this.data.bookdata)
}).catch(err => {
console.log(err)
})
console.log(this.data.start, this.data.limit)
},