Files
soybean-admin/src/router/helpers.ts
2021-09-22 16:56:25 +08:00

16 lines
484 B
TypeScript

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 setCacheName(component: Component, name?: string) {
if (name) {
Object.assign(component, { name });
}
}