var page = 1;
var limit = 5;
var GetList = function (that) {
that.setData({
hidden: false
});
wx.request({
url: url,
data: {
page: page,
limit: limit,
},
method: ‘POST’,
header: {
‘content-type’: ‘application/x-www-form-urlencoded’
},
success: function (res) {
console.log(“get:” + page)
var list = that.data.list;
for (var i = 0; i < res.data.length; i++) {
list.push(res.data[i].fields);
}
that.setData({
list: list,
});
page++;
that.setData({
hidden: true
});
}
});
}
Page({
data: {
hidden: false,
list: [],
scrollHeight: 0,
scrollTop:0
},
onLoad: function () {
var that = this;
wx.getSystemInfo({
success: function (res) {
console.info(‘heith’ + res.windowHeight);
that.setData({
scrollHeight: res.windowHeight
});
}
});
GetList(that);
},
bindDownLoad: function () {
// 该方法绑定了页面滑动到底部的事件
var that = this;
GetList(that);
},
})