Jelajahi Sumber

上拉加载

张文飞 3 tahun lalu
induk
melakukan
876d587870
1 mengubah file dengan 19 tambahan dan 4 penghapusan
  1. 19 4
      pages/homePage/homePage.vue

+ 19 - 4
pages/homePage/homePage.vue

@@ -202,6 +202,9 @@
 					"surplusTaskAmount": null
 				},
 				showGuide:false,
+				total:0,
+				pageNo:1,
+				pageSize:10
 			}
 		},
 		mounted() {
@@ -217,9 +220,16 @@
 				this.getData();
 			})
 		},
-		
+		onReachBottom() {
+			if(this.houseList.length<this.total){
+				this.pageNo ++;
+				this.getHomePage();
+			}
+			
+		},
 		methods: {
 			getData(){
+				this.pageNo = 1;
 				this.getUserInfo();
 				this.getHomePage();
 			},
@@ -228,14 +238,19 @@
 					url: "/project/homePage",
 					data: {
 						"city": "",
-						"pageNo": 1,
-						"pageSize": 20,
+						"pageNo": this.pageNo,
+						"pageSize": this.pageSize,
 						"taskCategoryId": ""
 					}
 				})
 				if (ret.data.success) {
 					let pageModel = ret.data.pageModel;
-					this.houseList = pageModel.resultSet || [];
+					let houseList = pageModel.resultSet || [];
+					if(this.pageNo==1){
+						this.houseList = [];
+					}
+					this.houseList = this.houseList.concat(houseList);
+					this.total = pageModel.total||0
 				}
 			},
 			async getUserInfo() {