Files
mengyadriftbottle/mengyadriftbottle-frontend/ENV_SETUP.md

29 lines
776 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 环境变量配置说明
## 开发环境
创建 `.env.development` 文件(或使用默认值):
```
VITE_API_BASE_URL=/api
VITE_ADMIN_URL=http://localhost:5002/admin/login
```
## 生产环境
创建 `.env.production` 文件:
```
VITE_API_BASE_URL=https://bottle.api.shumengya.top/api
VITE_ADMIN_URL=https://bottle.api.shumengya.top/admin/login
```
## 说明
- `VITE_API_BASE_URL`: 后端 API 的基础 URL
- `VITE_ADMIN_URL`: 管理员登录页面的 URL
前端会自动根据 `VITE_API_BASE_URL` 来设置背景图片的路径:
- 如果 `VITE_API_BASE_URL` 是完整的 URL`https://bottle.api.shumengya.top/api`),背景图片会从该域名加载
- 如果 `VITE_API_BASE_URL` 是相对路径(如 `/api`),背景图片会使用相对路径