|
@@ -17,6 +17,9 @@ Page({
|
|
|
|
|
|
//朋友圈
|
|
//朋友圈
|
|
cardList: [],
|
|
cardList: [],
|
|
|
|
+ loadedItems: 0, // 已加载的商品数量
|
|
|
|
+ pageSize: 6, // 每次加载的商品数量
|
|
|
|
+ noMoreItems: false, // 是否还有更多商品
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -106,15 +109,33 @@ Page({
|
|
Profilequery.equalTo('isVisible', true);
|
|
Profilequery.equalTo('isVisible', true);
|
|
Profilequery.notEqualTo('isDeleted', true)
|
|
Profilequery.notEqualTo('isDeleted', true)
|
|
Profilequery.equalTo('profile', profile1List2[0].objectId);
|
|
Profilequery.equalTo('profile', profile1List2[0].objectId);
|
|
-
|
|
|
|
|
|
+ Profilequery.descending('createdAt');
|
|
|
|
+ // 设置查询的限制和偏移
|
|
|
|
+ Profilequery.limit(this.data.pageSize);
|
|
|
|
+ Profilequery.skip(this.data.loadedItems);
|
|
let P = await Profilequery.find();
|
|
let P = await Profilequery.find();
|
|
let profile1List = P.map(item => item.toJSON());
|
|
let profile1List = P.map(item => item.toJSON());
|
|
- profile1List.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
|
|
|
|
- console.log(profile1List);
|
|
|
|
|
|
+ // 检查是否还有更多商品
|
|
|
|
+ if (profile1List.length < this.data.pageSize) {
|
|
|
|
+ this.setData({
|
|
|
|
+ noMoreItems: true
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.setData({
|
|
|
|
+ noMoreItems: false
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
this.setData({
|
|
this.setData({
|
|
- cardList: profile1List
|
|
|
|
|
|
+ cardList: this.data.cardList.concat(profile1List),
|
|
|
|
+ loadedItems: this.data.loadedItems + profile1List.length
|
|
})
|
|
})
|
|
console.log(this.data.cardList);
|
|
console.log(this.data.cardList);
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ loadMoreData: async function () {
|
|
|
|
+ // 触底时加载更多数据
|
|
|
|
+ if (!this.data.noMoreItems) {
|
|
|
|
+ await this.getcircle();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
})
|
|
})
|