Commit 3ddba9ae authored by sunguoshu's avatar sunguoshu

添加路由类型

parent 4ded0327
...@@ -33,9 +33,15 @@ export const useAppStore = defineStore('app', () => { ...@@ -33,9 +33,15 @@ export const useAppStore = defineStore('app', () => {
authRoutes.push(i.path!) authRoutes.push(i.path!)
return { ...obj, path: i.path } return { ...obj, path: i.path }
} }
if (i.type === 'dir') {
return { return {
...obj, ...obj,
children: transformToMenu(i.children ?? []) children: transformToMenu(i.children ?? []).filter((i) => i)
}
}
if (i.type === 'route') {
authRoutes.push(i.path!)
return null
} }
}) })
} }
...@@ -67,7 +73,7 @@ export const useAppStore = defineStore('app', () => { ...@@ -67,7 +73,7 @@ export const useAppStore = defineStore('app', () => {
} }
function setMenu(data: any[]) { function setMenu(data: any[]) {
const menu = transformToMenu(data) const menu = transformToMenu(data).filter((i) => i)
menuStore.setMenu(menu) menuStore.setMenu(menu)
} }
......
...@@ -33,7 +33,7 @@ declare global { ...@@ -33,7 +33,7 @@ declare global {
/** /**
* @title 菜单类型 * @title 菜单类型
*/ */
type: 'dir' | 'menu' type: 'dir' | 'menu' | 'route'
} }
export type User = { export type User = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment