fix(projects): 修复页面缓存

This commit is contained in:
Soybean
2021-09-22 16:56:25 +08:00
parent 4f05095336
commit fa0a907941
21 changed files with 332 additions and 136 deletions

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