data() {
return {
listData: [],
listTotal: []
}
},
methods: {
loadData: function(index, size) {
var _this = this;
this.$get("article/list", {
p: index, //
size: size //
}).then(function(res) {
_this.listData = res.list;
if (index == 1) { //
uni.setStorage({
key: "storage_list",
data: _this.listData
});
}
});
}
}
onReachBottom() { //
_this.pageIndexPP;
_this.loadData(_this.pageIndex, _this.pageSize); //
uni.getStorage({
key: "storage_list",
success: function(res) {
_this.listTotal = res.data.concat(_this.listData);
}
});
}
-sharp-sharp
this _ this.listData is a different 10-item array. How to put the _ this.listData in a _ this.listTotal? but when I write this, I can only merge the previous one, not overlay and merge each time. The value of _ this.listData will change every time I cycle. How to merge it?