mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-02-01 06:21:56 +08:00
按不同环境编译
This commit is contained in:
@@ -6,6 +6,7 @@ ENV = 'development'
|
||||
|
||||
# 篮球Zone后台管理系统/开发环境
|
||||
VUE_APP_BASE_API = '/dev-api'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
# nginx部署非根目录专用
|
||||
ENV_NG = '/'
|
||||
|
||||
@@ -6,3 +6,5 @@ ENV = 'production'
|
||||
|
||||
# 篮球Zone后台管理系统/生产环境
|
||||
VUE_APP_BASE_API = '/prod-api'
|
||||
# nginx部署非根目录专用
|
||||
ENV_NG = '/prod/'
|
||||
|
||||
@@ -8,3 +8,5 @@ ENV = 'staging'
|
||||
|
||||
# 篮球Zone后台管理系统/测试环境
|
||||
VUE_APP_BASE_API = '/stage-api'
|
||||
# nginx部署非根目录专用
|
||||
ENV_NG = '/stage/'
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "vue-cli-service serve",
|
||||
"dev:prod": "vue-cli-service serve --mode production",
|
||||
"dev:stage": "vue-cli-service serve --mode staging",
|
||||
"build:dev": "vue-cli-service build --mode development",
|
||||
"build:prod": "vue-cli-service build",
|
||||
"build:stage": "vue-cli-service build --mode staging",
|
||||
"preview": "node build/index.js --preview",
|
||||
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index';
|
||||
location.href = process.env.ENV_NG+'index';
|
||||
})
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
@@ -172,6 +172,7 @@ Router.prototype.push = function push(location) {
|
||||
|
||||
export default new Router({
|
||||
mode: 'history', // 去掉url中的#
|
||||
base: process.env.ENV_NG,
|
||||
scrollBehavior: () => ({ y: 0 }),
|
||||
routes: constantRoutes
|
||||
})
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
// 部署生产环境和开发环境下的URL。
|
||||
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
||||
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
||||
publicPath: process.env.ENV_NG,
|
||||
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
||||
outputDir: 'dist',
|
||||
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
||||
|
||||
Reference in New Issue
Block a user