Procházet zdrojové kódy

修复下拉刷新列表拼接的bug

shenxin před 5 roky
rodič
revize
bf4088896b
3 změnil soubory, kde provedl 16 přidání a 3 odebrání
  1. 5 1
      src/pages/classification.vue
  2. 5 1
      src/pages/index.vue
  3. 6 1
      src/pages/order.vue

+ 5 - 1
src/pages/classification.vue

@@ -155,8 +155,12 @@ export default {
       }
       const { code, data } = await getActivityList(params)
       if (code === 200) {
+        if (this.total === -1) {
+          this.activityList = data.rows
+        } else {
+          this.activityList = this.activityList.concat(data.rows)
+        }
         this.total = data.total_count
-        this.activityList = this.activityList.concat(data.rows)
         this.isLoadMore = this.total !== this.activityList.length
       }
       uni.stopPullDownRefresh()

+ 5 - 1
src/pages/index.vue

@@ -197,8 +197,12 @@ export default {
       }
       const { code, data } = await getActivityList(params)
       if (code === 200) {
+        if (this.total === -1) {
+          this.activityList = data.rows
+        } else {
+          this.activityList = this.activityList.concat(data.rows)
+        }
         this.total = data.total_count
-        this.activityList = this.activityList.concat(data.rows)
         this.isLoadMore = this.total !== this.activityList.length
       }
       uni.stopPullDownRefresh()

+ 6 - 1
src/pages/order.vue

@@ -139,7 +139,12 @@ export default {
       }
       const { code, data } = await getOrderList(params)
       if (code === 200) {
-        this.orderList = this.orderList.concat(data.rows)
+        if (this.total === -1) {
+          this.orderList = data.rows
+        } else {
+          this.orderList = this.orderList.concat(data.rows)
+        }
+
         this.total = data.total_count
         this.isLoadMore = this.total !== this.orderList.length
       }