feat: 新增直接打开dist/index.html文件访问的功能

新增命令build:file打包项目,可通过直接打开index.html访问
This commit is contained in:
log1997
2024-12-26 18:26:05 +08:00
parent 1b7f01f106
commit 84fd44f41e
6 changed files with 1353 additions and 68 deletions

View File

@@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router';
import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router';
import Layout from '@/layout/index.vue';
import Home from '@/views/Home/index.vue';
export const configRoutes={
@@ -130,9 +130,10 @@ const routes = [
],
},
];
const envMode=import.meta.env.MODE;
const router = createRouter({
history: createWebHistory(),
// 读取环境变量
history: envMode==='file'?createWebHashHistory():createWebHistory(),
routes,
});