出现这个问题是因为使用concat这个函数的对象,没有定义,就是需要连接的上一页的数据 和当前的数据变量,没有定义。
例如:
dataFormat: function (d) {
if (d.data.status == "1") {
if (d.data.pro) {
var datas = this.data.data.concat(d.data.pro), flag = d.data.pro.length < 4;//如果小于4,肯定加载完了,否则不确定
this.setData({
data: datas,
disabled: flag ? true : false,
moreTxt: flag ? "已加载全部数据" : "点击加载更多",
hasMore: true,
dataNull: true
});
} else {
this.setData({
hasMore: false,
dataNull: false
});
}
} else {
console.log('接口异常!')
}
wx.hideToast();
},
这里就是需要定义一下,datas才能用。不信试试