From a31e7651f7f5c62f0830c14f118219b37d4dde92 Mon Sep 17 00:00:00 2001 From: panyuyi Date: Thu, 13 Feb 2025 18:55:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9publicPath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +++ .env.production | 7 +++++-- vue.config.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.env.development b/.env.development index d5af85a..b2d8da4 100644 --- a/.env.development +++ b/.env.development @@ -1,6 +1,9 @@ # 开发环境配置 ENV = 'development' +# 服务路径 +VUE_APP_BASE_URL = / + # 开发环境 # VUE_APP_BASE_API = 'http://192.168.1.113:8081/data-admin/' # VUE_APP_BASE_API = 'http://192.168.1.20:19084/data-admin/' diff --git a/.env.production b/.env.production index eddcd02..f9dbda9 100644 --- a/.env.production +++ b/.env.production @@ -1,6 +1,9 @@ # 生产环境配置 ENV = 'admin' +# 服务路径 +VUE_APP_BASE_URL = /sgcyy-slgcyxgl + # 若依管理系统/生产环境 -VUE_APP_BASE_API = '/sgcyy-slgcyxgl/thinking' -VUE_APP_FAST_BASE_URL = 'http://192.168.1.20:9080/' +VUE_APP_BASE_API = /${VUE_APP_BASE_URL}/thinking +VUE_APP_FAST_BASE_URL = http://192.168.1.20:9080/ diff --git a/vue.config.js b/vue.config.js index 3a07f41..3a4aeb4 100644 --- a/vue.config.js +++ b/vue.config.js @@ -18,7 +18,7 @@ module.exports = { // 部署生产环境和开发环境下的URL。 // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 - publicPath: "./", + publicPath: process.env.VUE_APP_BASE_URL || "/", // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) outputDir: "dist", // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)