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

15
src/utils/router/index.ts Normal file
View File

@ -0,0 +1,15 @@
import type { Component } from 'vue';
import { EnumRoutePath } from '@/enum';
import type { RoutePathKey } from '@/interface';
/** 获取路由name map */
export function getRouteNameMap() {
return new Map<RoutePathKey, RoutePathKey>((Object.keys(EnumRoutePath) as RoutePathKey[]).map(v => [v, v]));
}
/** 给需要缓存的页面组件设置名称 */
export function setRouterCacheName(component: Component, name?: string) {
if (name) {
Object.assign(component, { name });
}
}