|
@@ -17,6 +17,9 @@ Page({
|
|
|
|
|
|
|
|
|
cardList: [],
|
|
|
+ loadedItems: 0,
|
|
|
+ pageSize: 6,
|
|
|
+ noMoreItems: false,
|
|
|
},
|
|
|
|
|
|
|
|
@@ -106,15 +109,33 @@ Page({
|
|
|
Profilequery.equalTo('isVisible', true);
|
|
|
Profilequery.notEqualTo('isDeleted', true)
|
|
|
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 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({
|
|
|
- cardList: profile1List
|
|
|
+ cardList: this.data.cardList.concat(profile1List),
|
|
|
+ loadedItems: this.data.loadedItems + profile1List.length
|
|
|
})
|
|
|
console.log(this.data.cardList);
|
|
|
},
|
|
|
-
|
|
|
+ loadMoreData: async function () {
|
|
|
+
|
|
|
+ if (!this.data.noMoreItems) {
|
|
|
+ await this.getcircle();
|
|
|
+ }
|
|
|
+ },
|
|
|
})
|