Bläddra i källkod

Merge pull request #97 from ideal-5/feat/request-interceptors

feat: 在H5代理请求环境下,拼接代理前缀
菲鸽 1 år sedan
förälder
incheckning
77c2165406
1 ändrade filer med 2 tillägg och 1 borttagningar
  1. 2 1
      src/interceptors/request.ts

+ 2 - 1
src/interceptors/request.ts

@@ -31,7 +31,8 @@ const httpInterceptor = {
       // #ifdef H5
       // console.log(__VITE_APP_PROXY__)
       if (JSON.parse(__VITE_APP_PROXY__)) {
-        // 啥都不需要做
+        // 自动拼接代理前缀
+        options.url = import.meta.env.VITE_APP_PROXY_PREFIX + options.url
       } else {
         options.url = baseUrl + options.url
       }