Commit 3ddba9ae authored by sunguoshu's avatar sunguoshu

添加路由类型

parent 4ded0327
......@@ -33,9 +33,15 @@ export const useAppStore = defineStore('app', () => {
authRoutes.push(i.path!)
return { ...obj, path: i.path }
}
return {
...obj,
children: transformToMenu(i.children ?? [])
if (i.type === 'dir') {
return {
...obj,
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', () => {
}
function setMenu(data: any[]) {
const menu = transformToMenu(data)
const menu = transformToMenu(data).filter((i) => i)
menuStore.setMenu(menu)
}
......
......@@ -33,7 +33,7 @@ declare global {
/**
* @title 菜单类型
*/
type: 'dir' | 'menu'
type: 'dir' | 'menu' | 'route'
}
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