| 332 | ]; |
| 333 | |
| 334 | function routersConfigOptimize( |
| 335 | config: RouterConfig[], |
| 336 | list: Array<{ name: string; path: string; permission: number }> = [] |
| 337 | ) { |
| 338 | for (const r of config) { |
| 339 | r.meta.breadcrumbs = list; |
| 340 | if (r.children && r.children instanceof Array) { |
| 341 | const newList = JSON.parse(JSON.stringify(list)); |
| 342 | newList.push({ |
| 343 | name: r.name, |
| 344 | path: r.path, |
| 345 | mainMenu: r.meta.mainMenu, |
| 346 | permission: r.meta.permission |
| 347 | }); |
| 348 | routersConfigOptimize(r.children, newList); |
| 349 | } |
| 350 | } |
| 351 | return config; |
| 352 | } |
| 353 | |
| 354 | const router = createRouter({ |
| 355 | history: createWebHashHistory(), |