tremble il y a 3 ans
Parent
commit
84a7b4b5af
2 fichiers modifiés avec 23 ajouts et 20 suppressions
  1. 23 19
      src/components/Tags/goods-list.vue
  2. 0 1
      src/utils/wxshare.js

+ 23 - 19
src/components/Tags/goods-list.vue

@@ -154,28 +154,32 @@ const updateProductsById = async (idx) => {
     return;
   }
   Loading.show();
-  let res = await apis.get_product_info({
-    // productId: 'p15677829'
-    productId: tagclick.value.data.products[idx].id,
-  });
+  try {
+    let res = await apis.get_product_info({
+      // productId: 'p15677829'
+      productId: tagclick.value.data.products[idx].id,
+    });
 
-  let tempData = toRaw(tagclick.value.data);
+    let tempData = toRaw(tagclick.value.data);
 
-  tempData.products[idx] = {
-    ...tempData.products[idx],
-    ...res.data,
-    currentSku: res.data.skus[0] || {
-      price: "",
-      id: "",
-    },
-    cartnum: 1,
-  };
+    tempData.products[idx] = {
+      ...tempData.products[idx],
+      ...res.data,
+      currentSku: res.data.skus[0] || {
+        price: "",
+        id: "",
+      },
+      cartnum: 1,
+    };
 
-  store.commit("tag/setTagClickType", {
-    type: tagclick.value.type,
-    data: tempData,
-  });
-  Loading.hide();
+    store.commit("tag/setTagClickType", {
+      type: tagclick.value.type,
+      data: tempData,
+    });
+    Loading.hide();
+  } catch (error) {
+    Loading.hide();
+  }
 };
 
 watch(

+ 0 - 1
src/utils/wxshare.js

@@ -1,5 +1,4 @@
 import browser from '@/utils/browser'
-import { http } from './request'
 import jsonp from 'jsonp'
 function toConfigure() {
     return new Promise((resolve, reject) => {