基于 /proxy-api 实现代理,简化 env.local 配置

This commit is contained in:
YunaiV 2022-07-28 21:20:18 +08:00
parent d872676748
commit cba217cc29
2 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,8 @@ ENV = 'development'
VUE_APP_TITLE = 芋道管理系统 VUE_APP_TITLE = 芋道管理系统
# 芋道管理系统/本地环境 # 芋道管理系统/本地环境
VUE_APP_BASE_API = '/dev-api' # VUE_APP_BASE_API = '/proxy-api'
VUE_APP_BASE_API = 'http://127.0.0.1:48080'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -35,7 +35,7 @@ module.exports = {
open: true, open: true,
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { ['/proxy-api']: {
target: `http://localhost:48080`, target: `http://localhost:48080`,
// target: `http://api-dashboard.yudao.iocoder.cn`, // target: `http://api-dashboard.yudao.iocoder.cn`,
changeOrigin: true, changeOrigin: true,