Bladeren bron

fix: _suppressToast标记泄漏导致微信框架报MiniProgramError

- reject前删除_suppressToast内部标记,避免泄漏到外层调用方
- fetchBanner增加空catch避免未处理rejection

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 1 dag geleden
bovenliggende
commit
552309a196
2 gewijzigde bestanden met toevoegingen van 6 en 2 verwijderingen
  1. 1 1
      charge-front/src/pages/map/map.vue
  2. 5 1
      charge-front/src/utils/http.ts

+ 1 - 1
charge-front/src/pages/map/map.vue

@@ -626,7 +626,7 @@ const fetchCharging = () => {
 const fetchBanner = () => {
   fetchHomeBanner().then((res) => {
     mapBanner.value = res.filter((item: any) => item.status === 1);
-  });
+  }).catch(() => {});
 };
 
 // const checkDiscounts = () => {

+ 5 - 1
charge-front/src/utils/http.ts

@@ -106,7 +106,11 @@ class Http {
           }
         })
         .catch((err) => {
-          if (err && err.errMsg && !err._suppressToast && options && options.statusCodeHandle) {
+          const suppressToast = err && err._suppressToast;
+          if (err) {
+            delete err._suppressToast;
+          }
+          if (err && err.errMsg && !suppressToast && options && options.statusCodeHandle) {
             uni.showToast({
               title: `${err.errMsg}`,
               icon: "none",