feat: 新增直接打开dist/index.html文件访问的功能
新增命令build:file打包项目,可通过直接打开index.html访问
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user