This commit is contained in:
Leo_Ding 2025-12-02 15:14:07 +08:00
parent 7b51376c5b
commit 553b76cd3b
2 changed files with 11 additions and 7 deletions

View File

@ -2,8 +2,9 @@
import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
// 从环境变量读取基础 URL
const BASE_URL = import.meta.env.VITE_API_BASIC;
const BASE_URL = import.meta.env.MODE === 'development'?'http://10.10.1.27:8888':'http://10.10.1.27:8888';
console.log('API Basic URL:', BASE_URL);
console.log('All env:', import.meta.env);
// 创建 axios 实例
const request: AxiosInstance = axios.create({
baseURL: BASE_URL,

View File

@ -5,11 +5,6 @@ import { fileURLToPath, URL } from "node:url";
import path from "path";
export default defineConfig({
plugins: [vue()],
// resolve: {
// alias: {
// '@': fileURLToPath(new URL('./src', import.meta.url))
// }
// },
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
@ -19,5 +14,13 @@ export default defineConfig({
port: 8080, // 设置开发服务器端口为 8080
host: true,
open: true, // 可选:启动时自动打开浏览器
proxy: {
"/v1": {
target: "http://10.10.1.27:8888",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/v1/, '')
}
}
},
});