fix: 修复菜单快捷搜索问题 (#67)

This commit is contained in:
oldR
2025-05-25 10:42:45 +08:00
committed by GitHub
parent 9faee319dd
commit f66f80fc56
2 changed files with 13 additions and 14 deletions

View File

@@ -107,15 +107,14 @@ const searchRoutes = (keyword: string) => {
const result: SearchResult[] = []
const loop = (routes: RouteRecordRaw[]) => {
routes.forEach((route) => {
if (route.meta?.title?.toLowerCase().includes(keyword.toLowerCase()) && !route.meta?.hidden) {
result.push({
title: route.meta.title,
path: route.path,
})
}
if (route.children && route.children.length > 0) {
loop(route.children)
} else {
if (route.meta?.title?.toLowerCase().includes(keyword.toLowerCase())) {
result.push({
title: route.meta.title,
path: route.path,
})
}
}
})
}