Browse Source

Signed-off-by: liuboyan <632697560@qq.com>
下拉刷新

liuboyan 4 years ago
parent
commit
e5913005fd
1 changed files with 13 additions and 3 deletions
  1. 13 3
      pagesMain/plantList.vue

+ 13 - 3
pagesMain/plantList.vue

@@ -39,6 +39,11 @@
 		onLoad() {
 			this.getGoodsList()
 		},
+		onPullDownRefresh() {
+			this.pageIndex = 1
+			this.plantList = []
+			this.getGoodsList('refresh')
+		},
 		methods: {
 			//  懒加载
 			handleLoadMore() {
@@ -48,11 +53,14 @@
 				}
 			},
 			//  获取商品
-			getGoodsList() {
+			getGoodsList(refresh) {
 				NET.request(API.getPlantList, {
 					pageIndex: this.pageIndex,
 					pageSize: 10,
 				}, 'GET').then(res => {
+					if (refresh == 'refresh') {
+						uni.stopPullDownRefresh();
+					}
 					if (res.isSuccess) {
 						if (res.data.list.length) {
 							this.isOver = res.data.list.length != 10
@@ -74,7 +82,7 @@
 				})
 			},
 			//  跳转详情
-			goToGoodDetail(item){
+			goToGoodDetail(item) {
 				uni.navigateTo({
 					url: '/pagesGood/goodDetails?minePlant=true&goodId=' + item.id
 				});
@@ -95,9 +103,11 @@
 		float: left;
 		background-color: #f7f7f7;
 		overflow-y: auto;
-		.goods-row:first-child{
+
+		.goods-row:first-child {
 			margin-top: 12px;
 		}
+
 		.goods-row {
 			width: calc(100% - 24px);
 			height: 104px;