mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-10-12 21:03:42 +08:00
refactor(projects): 路由文件夹重构
This commit is contained in:
@@ -1,23 +1,3 @@
|
||||
import type { Component } from 'vue';
|
||||
import { EnumRoutePath } from '@/enum';
|
||||
import type { RoutePathKey } from '@/interface';
|
||||
import { router } from '@/router';
|
||||
|
||||
/** 获取路由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 });
|
||||
}
|
||||
}
|
||||
|
||||
// 获取登录后的重定向地址
|
||||
export function getLoginRedirectUrl() {
|
||||
const path = router.currentRoute.value.fullPath as EnumRoutePath;
|
||||
const redirectUrl = path === EnumRoutePath.root ? undefined : path;
|
||||
return redirectUrl;
|
||||
}
|
||||
export { ROUTE_NAME_MAP, setRouterCacheName, getLoginRedirectUrl, setSingleRoute } from './helpers';
|
||||
export { default as getCacheRoutes } from './cache';
|
||||
export { default as transformRouteToMenu } from './menus';
|
||||
|
Reference in New Issue
Block a user