This commit is contained in:
Dede Fuji Abdul
2023-10-24 15:24:21 +07:00
parent 6931e06952
commit 96d8550cfe
9 changed files with 199 additions and 215 deletions

View File

@ -30,26 +30,6 @@ const convertToDashedString = (input: string): string => {
return `/${parts.join('-')}`;
}
// export const convertRouteToMenu = (data: RouteRecordRaw[], basePath: string = '/home', iconIndex: number = 0): MenuItemModel[] => {
// return data.filter((i) => i.path !== '').map((item) => {
// const convertedItem: MenuItemModel = {
// name: item.name?.toString() || '',
// path: convertToDashedString(`${basePath}/${item.path}`).replace('/home-', '/home/'),
// expanded: false,
// icon: undefined,
// children: [],
// };
// if (item.children) {
// convertedItem.icon = navigationIcon[iconIndex];
// iconIndex = (iconIndex + 1) % navigationIcon.length;
// convertedItem.children = convertRouteToMenu(item.children, `${basePath}/${item.path}`, iconIndex);
// }
// return convertedItem
// })
// }
export const convertRouteToMenu = (data: RouteRecordRaw[], basePath: string = '/home', iconIndex: number = 0): MenuItemModel[] => {
return data.filter((i) => i.path !== '').map((item) => {
const convertedItem: MenuItemModel = {