<scroll-view scroll-y="true" bindscrolltolower="loadList" class="layout"> </scroll-view>
const app = getApp();
import API from "../../utils/api.js";
Page({
data:{
tipShow:false,
page: 0,
nextPage:"",
us: "",
lists:[]
},
onLoad: function (e) {
var listArr = [],
self = this,
page = self.data.page,
us = self.data.us,
data = {
page : page,
nextPage: self.data.nextPage,
us : us
};
self.requestData(self,data);
},
// 下拉加载数据
loadList:function (e){
var listArray = [],
self = this;
if(!self.tipShow) {
var page = Number(self.data.page);
// self.data.nextPage = sel;
var data = {
page :page,
nextPage : page + 1,
us : self.data.us
};
self.requestData(self,data);
}
},
requestData: function (self,data){
app.requestData(API.hot,data,(err,data) => {
var nextPage = data.nextPage;
if(data != null) {
self.setData({
page: self.data.page + 1,
nextPage:nextPage,
lists: self.data.lists.concat(self.dataRead(data.lst))
});
} else {
self.setData({
tipShow:true
});
}
});
}