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({