panhui 5 жил өмнө
parent
commit
6f53674ad2

+ 6 - 8
src/pages/Home.vue

@@ -271,7 +271,7 @@ export default {
         ...mapState(['userInfo', 'barHeight']),
         hotProductsList() {
             return this.hotProducts.map(item => {
-                return { name: this.getName(item), products: item.products, img: item.img };
+                return { name: this.getName(item), products: item.products, mainProduct: item.mainProduct };
             });
         },
         nowProductsList() {
@@ -279,14 +279,12 @@ export default {
 
             return list;
         },
+        nowHotProductInfo() {
+            const allList = [...this.hotProductsList];
+            return allList[Number(this.activeIndex)] ? allList[Number(this.activeIndex)] : {};
+        },
         mainProductInfo() {
-            const list = [...this.nowProductsList];
-            let info = list.shift() || {};
-            if (this.hotProductsList[this.hotActive] && this.hotProductsList[this.hotActive].img) {
-                info.img = this.hotProductsList[this.hotActive].img;
-            }
-
-            return info;
+            return { ...this.nowHotProductInfo }.mainProduct;
         },
         swiperProduct() {
             const list = [...this.nowProductsList];

+ 1 - 1
src/pagesProduct/ContrastDetail.vue

@@ -316,7 +316,7 @@ export default {
                 } else {
                     return {
                         ...item,
-                        chName: item.chName.replace(/' '/g, '')
+                        chName: item.chName.replace(/ /g, '')
                     };
                 }
             });