refactor:优化前台顶栏菜单被点击时无需激活的菜单项的处理

This commit is contained in:
妙码生花 2024-11-11 15:47:43 +08:00
parent 3db75e0ff2
commit 028710bcb9

View File

@ -120,7 +120,11 @@ const setActiveMenu = (route: RouteLocationNormalizedLoaded) => {
* 检查菜单是否需要激活如果否还原 state.activeMenu * 检查菜单是否需要激活如果否还原 state.activeMenu
*/ */
const onSelect = (index: string) => { const onSelect = (index: string) => {
if (noNeedActive(siteConfig.headNav, index) || noNeedActive(memberCenter.state.navUserMenus, index)) { if (
noNeedActive(siteConfig.headNav, index) ||
noNeedActive(memberCenter.state.navUserMenus, index) ||
noNeedActive(memberCenter.state.viewRoutes, index)
) {
const oldActiveMenu = state.activeMenu const oldActiveMenu = state.activeMenu
state.activeMenu = '' state.activeMenu = ''
nextTick(() => { nextTick(() => {