42 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-11-26 14:45:42 +08:00
import type { RouterHistory } from "vue-router"
import { createWebHashHistory, createWebHistory } from "vue-router"
/** 路由配置 */
2024-11-26 14:45:42 +08:00
interface RouterConfig {
/**
* @name
* @description hash html5
*/
history: RouterHistory
/**
* @name
* @description 1. roles
* @description 2. dynamic: false
*/
dynamic: boolean
2024-11-18 19:40:44 +08:00
/**
* @name
* @description
* @description 1. 访
* @description 2.
*/
defaultRoles: Array<string>
/**
* @name
* @description 1.
* @description 2.
*/
thirdLevelRouteCache: boolean
}
2024-11-26 14:45:42 +08:00
const VITE_ROUTER_HISTORY = import.meta.env.VITE_ROUTER_HISTORY
const VITE_PUBLIC_PATH = import.meta.env.VITE_PUBLIC_PATH
export const routerConfig: RouterConfig = {
history: VITE_ROUTER_HISTORY === "hash" ? createWebHashHistory(VITE_PUBLIC_PATH) : createWebHistory(VITE_PUBLIC_PATH),
dynamic: true,
defaultRoles: ["DEFAULT_ROLE"],
thirdLevelRouteCache: false
}