mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(components): add GlobalSearch components
This commit is contained in:
@ -310,3 +310,22 @@ export function getBreadcrumbsByRoute(
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform menu to searchMenus
|
||||
*
|
||||
* @param menus - menus
|
||||
* @param treeMap
|
||||
*/
|
||||
export function transformMenuToSearchMenus(menus: App.Global.Menu[], treeMap: App.Global.Menu[] = []) {
|
||||
if (menus && menus.length === 0) return [];
|
||||
return menus.reduce((acc, cur) => {
|
||||
if (!cur.children) {
|
||||
acc.push(cur);
|
||||
}
|
||||
if (cur.children && cur.children.length > 0) {
|
||||
transformMenuToSearchMenus(cur.children, treeMap);
|
||||
}
|
||||
return acc;
|
||||
}, treeMap);
|
||||
}
|
||||
|
Reference in New Issue
Block a user