From b7cad430bca0d9531dd425f20832cb0cee21dd39 Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Tue, 27 Feb 2024 15:14:49 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E9=9B=86=E6=88=90:=20=F0=9F=8E=A1=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0docker=EF=BC=9B=E6=B7=BB=E5=8A=A0=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E7=8E=AF=E5=A2=83=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 3 +++ .env.development | 3 +++ .env.test | 4 ++++ package.json | 1 + public/index.html | 2 +- src/router/index.ts | 5 +++-- src/views/layout.vue | 2 +- vue.config.js | 25 +++++++++++++++++++++++++ 8 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 .env create mode 100644 .env.development create mode 100644 .env.test diff --git a/.env b/.env new file mode 100644 index 0000000..1b7786e --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +# 请求api地址:process.env.VUE_APP_URL +VUE_APP_URL=http://localhost:8088/xxx +VUE_APP_FLAG = 'prod' diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..c20c746 --- /dev/null +++ b/.env.development @@ -0,0 +1,3 @@ +# 请求api地址:process.env.VUE_APP_URL +VUE_APP_URL=http://localhost:8088/xxx +VUE_APP_FLAG = 'dev' diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..c8d5f43 --- /dev/null +++ b/.env.test @@ -0,0 +1,4 @@ +NODE_ENV = 'production' +# 请求api地址:process.env.VUE_APP_URL +VUE_APP_URL=http://localhost:8088/xxx +VUE_APP_FLAG = 'test' diff --git a/package.json b/package.json index 0c93460..d515a25 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", + "testbuild": "vue-cli-service build --mode test", "lint": "vue-cli-service lint", "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src", "lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"", diff --git a/public/index.html b/public/index.html index 3e5a139..a1a3aa0 100644 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,7 @@ - + <%= htmlWebpackPlugin.options.title %> diff --git a/src/router/index.ts b/src/router/index.ts index 08baa11..44674b8 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router'; +import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'; const routes: Array = [ { @@ -13,7 +13,8 @@ const routes: Array = [ * 如果不需要 createWebHistory */ const router = createRouter({ - history: createWebHashHistory(process.env.BASE_URL), + history: + process.env.NODE_ENV === 'production' ? createWebHashHistory(process.env.BASE_URL) : createWebHashHistory(process.env.BASE_URL), routes, }); diff --git a/src/views/layout.vue b/src/views/layout.vue index 5257ab6..71d47b7 100644 --- a/src/views/layout.vue +++ b/src/views/layout.vue @@ -1,5 +1,5 @@