ruoyi-plus-soybean/src/router/index.ts

20 lines
581 B
TypeScript
Raw Normal View History

import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
2021-08-17 14:59:59 +08:00
import type { App } from 'vue';
import type { RouteRecordRaw } from 'vue-router';
import { customRoutes } from './routes';
import createRouterGuide from './permission';
const routes: Array<RouteRecordRaw> = [...customRoutes];
const isVercel = import.meta.env.VITE_HTTP_ENV === 'VERCEL';
2021-08-18 12:02:59 +08:00
export const router = createRouter({
history: isVercel ? createWebHashHistory() : createWebHistory(),
2021-08-17 14:59:59 +08:00
routes
});
export function setupRouter(app: App) {
app.use(router);
2021-08-26 14:09:31 +08:00
createRouterGuide(router);
2021-08-17 14:59:59 +08:00
}