function dynamicRouter(roleList) {
let asyncRouter = []
roleList.forEach((itemRouter, index) => {
const path = [...manageRoutesMap]
const authRoute = path.find((v) => v.path === itemRouter.resRoute)
asyncRouter.push({
path: itemRouter.resRoute,
name: itemRouter.name,
children: itemRouter.subs.length > 0 ? itemRouter.subs : null,
component: authRoute?.component,
})
if (itemRouter.subs && itemRouter.subs.length > 0) {
asyncRouter[index].children = dynamicRouter(itemRouter.subs)
}
})
return asyncRouter
}