mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
fix(projects): 修复权限切换路由数据未更新的问题
This commit is contained in:
@ -2,7 +2,13 @@ import type { RouteRecordRaw } from 'vue-router';
|
||||
import { consoleError } from '../common';
|
||||
import { getLayoutComponent, getViewComponent } from './component';
|
||||
|
||||
type ComponentAction = Record<AuthRoute.RouteComponent, () => void>;
|
||||
/**
|
||||
* 获取所有固定路由的名称集合
|
||||
* @param routes - 固定路由
|
||||
*/
|
||||
export function getConstantRouteNames(routes: AuthRoute.Route[]) {
|
||||
return routes.map(route => getConstantRouteName(route)).flat(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将权限路由转换成vue路由
|
||||
@ -59,6 +65,20 @@ export function transformRoutePathToRouteName(
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有固定路由的名称集合
|
||||
* @param route - 固定路由
|
||||
*/
|
||||
function getConstantRouteName(route: AuthRoute.Route) {
|
||||
const names = [route.name];
|
||||
if (hasChildren(route)) {
|
||||
names.push(...route.children!.map(item => getConstantRouteName(item)).flat(1));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
type ComponentAction = Record<AuthRoute.RouteComponent, () => void>;
|
||||
|
||||
/**
|
||||
* 将单个权限路由转换成vue路由
|
||||
* @param item - 单个权限路由
|
||||
|
Reference in New Issue
Block a user