refactor(projects): 路由文件夹拆分模块,代码重构

This commit is contained in:
Soybean
2021-10-11 17:51:16 +08:00
parent f0474bd961
commit 73505d914f
25 changed files with 2408 additions and 2131 deletions

18
src/router/setup/index.ts Normal file
View File

@@ -0,0 +1,18 @@
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
import type { App } from 'vue';
import { routes } from '../routes';
import createRouterGuide from '../permission';
/** 用于部署vercel托管服务 */
const isStaging = import.meta.env.VITE_HTTP_ENV === 'STAGING';
export const router = createRouter({
history: isStaging ? createWebHashHistory() : createWebHistory(),
routes
});
export async function setupRouter(app: App) {
app.use(router);
createRouterGuide(router);
await router.isReady();
}