项目中遇到一个问题:
问题一:
IndexList是加载列表页数据的方法,getItems()是加载更多数据的方法,放在onReachBottom()中,onReachBottom()是小程序api中触底加载事件。
IndexList: function() {
var n = this, o = [];
page = 1;
var e = wx.getStorageSync("openid");
app.util.request({
url: "entry/wxapp/IndexList",
data: {
openid: e
},
success: function(e) {
for (var t = e.data.data, a = 0; a < t.length; a++) {
o.push(t[a]);
}
n.setData({
IndexList: o
});
if (o.length < 0) {
n.setData({
show: true
});
}
},
fail: function(e) {
console.log(e);
}
}), n.setData({
currentTab: null
});
console.log('indexlist的 '+ page)
},
onReachBottom: function() {
wx.showLoad