refactor:前台菜单的路由路径支持 query

This commit is contained in:
妙码生花 2024-11-10 15:59:08 +08:00
parent b75e44f9ff
commit 3db75e0ff2
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@
:key="index"
@click="routerPush('', menu)"
class="user-menu-item"
:class="route.name == menu.name ? 'active' : ''"
:class="route.fullPath == menu.path ? 'active' : ''"
>
<Icon :name="menu.meta?.icon" size="16" color="var(--el-text-color-secondary)" />
<span>{{ menu.meta?.title }}</span>

View File

@ -165,7 +165,7 @@ const isExternalLink = (menus: RouteRecordRaw[], index: string): boolean => {
const searchMenuIndex = (menus: RouteRecordRaw[], route: RouteLocationNormalizedLoaded): number | false => {
let find: boolean | number = false
for (const key in menus) {
if (menus[key].meta?.id && (menus[key].path == route.fullPath || menus[key].name == route.name)) {
if (menus[key].meta?.id && menus[key].path == route.fullPath) {
return menus[key].meta.id as number
}
if (menus[key].children && menus[key].children?.length) {