From 905476abf795756c1e1b51a8dc0be530cb142dd3 Mon Sep 17 00:00:00 2001 From: zclzone Date: Wed, 29 May 2024 21:48:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9C=AC=E5=9C=B0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=94=B9=E7=94=A8=E7=9B=B4=E8=B0=83apifox=E4=BA=91=E7=AB=AFmoc?= =?UTF-8?q?k=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 9 ++++++--- src/utils/http/index.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.env.development b/.env.development index 23d1640..57029b3 100644 --- a/.env.development +++ b/.env.development @@ -4,6 +4,9 @@ VITE_USE_HASH = 'true' # 资源公共路径,需要以 /开头和结尾 VITE_PUBLIC_PATH = '/' -# 代理配置-target 本地服务 | Apifox云端mock -# VITE_PROXY_TARGET = 'http://localhost:8085' -VITE_PROXY_TARGET = 'https://mock.apifox.com/m1/3776410-0-default/' +# Axios 基础路径 +# VITE_AXIOS_BASE_URL = '/api' # 用于代理 +VITE_AXIOS_BASE_URL = 'https://mock.apifox.com/m1/3776410-0-default' # apifox云端mock + +# 代理配置-target +VITE_PROXY_TARGET = 'http://localhost:8085' diff --git a/src/utils/http/index.js b/src/utils/http/index.js index d607959..b0d5ca0 100644 --- a/src/utils/http/index.js +++ b/src/utils/http/index.js @@ -12,7 +12,7 @@ import { setupInterceptors } from './interceptors' export function createAxios(options = {}) { const defaultOptions = { - baseURL: '/api', + baseURL: import.meta.env.VITE_AXIOS_BASE_URL, timeout: 12000, } const service = axios.create({