优化前端代码

This commit is contained in:
limengnan 2025-05-30 15:15:10 +08:00
parent a4f3f7510f
commit 0a54bd7b3f
3 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,8 @@
## 开发环境
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV='development'
VITE_APP_TITLE = ''
VITE_APP_PORT = 3000
VITE_API_BASE_URL = '/api'

6
frontend/.env.production Normal file
View File

@ -0,0 +1,6 @@
## 生产环境
NODE_ENV='production'
VITE_APP_TITLE = 'NewFrameWork2023-WEB'
VITE_APP_PORT = 3000
VITE_API_BASE_URL = ''

View File

@ -2,6 +2,7 @@ import axios from 'axios'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { useUserStore } from '@/store/user' import { useUserStore } from '@/store/user'
import router from '@/router' import router from '@/router'
console.log( import.meta.env.VITE_API_BASE_URL)
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({