mirror of
https://github.com/fugary/simple-element-plus-template.git
synced 2025-11-12 14:27:49 +00:00
类型优化
This commit is contained in:
@@ -54,3 +54,22 @@ export const filterMenus = menus => menus.filter(menu => !menu.disabled)
|
||||
}
|
||||
return menu
|
||||
})
|
||||
|
||||
/**
|
||||
* 如果有replaceTabHistory,获取上级菜单
|
||||
* @function useParentRoute
|
||||
* @param route {RouteRecordMultipleViewsWithChildren} 路由信息
|
||||
*/
|
||||
export const useParentRoute = function (route) {
|
||||
const parentName = route.meta?.replaceTabHistory
|
||||
if (parentName) {
|
||||
const routes = route.matched || []
|
||||
for (let i = routes.length - 1; i > 0; i--) {
|
||||
const r = routes[i]
|
||||
if ((!r.meta || !r.meta.replaceTabHistory) && r.path !== '/') {
|
||||
return r
|
||||
}
|
||||
}
|
||||
}
|
||||
return route
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user