Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 384c5d7d
authored
Apr 05, 2025
by
wyc001122
Committed by
GitHub
Apr 05, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 布局为双列菜单或者水平模式下, 一级菜单高亮问题 (#5870)
Co-authored-by: 王泳超 <wangyongchao@testor.com.cn>
1 parent
b0ad08db
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
15 deletions
packages/@core/ui-kit/menu-ui/src/components/menu.vue
packages/effects/layouts/src/basic/menu/use-extra-menu.ts
packages/effects/layouts/src/basic/menu/use-mixed-menu.ts
packages/effects/layouts/src/basic/menu/use-navigation.ts
packages/@core/ui-kit/menu-ui/src/components/menu.vue
View file @
384c5d7
...
@@ -23,7 +23,6 @@ import {
...
@@ -23,7 +23,6 @@ import {
import
{
useNamespace
}
from
'@vben-core/composables'
;
import
{
useNamespace
}
from
'@vben-core/composables'
;
import
{
Ellipsis
}
from
'@vben-core/icons'
;
import
{
Ellipsis
}
from
'@vben-core/icons'
;
import
{
isHttpUrl
}
from
'@vben-core/shared/utils'
;
import
{
useResizeObserver
}
from
'@vueuse/core'
;
import
{
useResizeObserver
}
from
'@vueuse/core'
;
...
@@ -248,9 +247,6 @@ function handleMenuItemClick(data: MenuItemClicked) {
...
@@ -248,9 +247,6 @@ function handleMenuItemClick(data: MenuItemClicked) {
if
(
!
path
||
!
parentPaths
)
{
if
(
!
path
||
!
parentPaths
)
{
return
;
return
;
}
}
if
(
!
isHttpUrl
(
path
))
{
activePath
.
value
=
path
;
}
emit
(
'select'
,
path
,
parentPaths
);
emit
(
'select'
,
path
,
parentPaths
);
}
}
...
...
packages/effects/layouts/src/basic/menu/use-extra-menu.ts
View file @
384c5d7
...
@@ -13,7 +13,7 @@ import { useNavigation } from './use-navigation';
...
@@ -13,7 +13,7 @@ import { useNavigation } from './use-navigation';
function
useExtraMenu
(
useRootMenus
?:
ComputedRef
<
MenuRecordRaw
[]
>
)
{
function
useExtraMenu
(
useRootMenus
?:
ComputedRef
<
MenuRecordRaw
[]
>
)
{
const
accessStore
=
useAccessStore
();
const
accessStore
=
useAccessStore
();
const
{
navigation
}
=
useNavigation
();
const
{
navigation
,
willOpenedByWindow
}
=
useNavigation
();
const
menus
=
computed
(()
=>
useRootMenus
?.
value
??
accessStore
.
accessMenus
);
const
menus
=
computed
(()
=>
useRootMenus
?.
value
??
accessStore
.
accessMenus
);
...
@@ -33,11 +33,15 @@ function useExtraMenu(useRootMenus?: ComputedRef<MenuRecordRaw[]>) {
...
@@ -33,11 +33,15 @@ function useExtraMenu(useRootMenus?: ComputedRef<MenuRecordRaw[]>) {
* @param menu
* @param menu
*/
*/
const
handleMixedMenuSelect
=
async
(
menu
:
MenuRecordRaw
)
=>
{
const
handleMixedMenuSelect
=
async
(
menu
:
MenuRecordRaw
)
=>
{
extraMenus
.
value
=
menu
?.
children
??
[];
const
_extraMenus
=
menu
?.
children
??
[];
extraActiveMenu
.
value
=
menu
.
parents
?.[
parentLevel
.
value
]
??
menu
.
path
;
const
hasChildren
=
_extraMenus
.
length
>
0
;
const
hasChildren
=
extraMenus
.
value
.
length
>
0
;
if
(
!
willOpenedByWindow
(
menu
.
path
))
{
extraMenus
.
value
=
_extraMenus
??
[];
extraActiveMenu
.
value
=
menu
.
parents
?.[
parentLevel
.
value
]
??
menu
.
path
;
sidebarExtraVisible
.
value
=
hasChildren
;
}
sidebarExtraVisible
.
value
=
hasChildren
;
if
(
!
hasChildren
)
{
if
(
!
hasChildren
)
{
await
navigation
(
menu
.
path
);
await
navigation
(
menu
.
path
);
}
else
if
(
preferences
.
sidebar
.
autoActivateChild
)
{
}
else
if
(
preferences
.
sidebar
.
autoActivateChild
)
{
...
...
packages/effects/layouts/src/basic/menu/use-mixed-menu.ts
View file @
384c5d7
...
@@ -10,7 +10,7 @@ import { findRootMenuByPath } from '@vben/utils';
...
@@ -10,7 +10,7 @@ import { findRootMenuByPath } from '@vben/utils';
import
{
useNavigation
}
from
'./use-navigation'
;
import
{
useNavigation
}
from
'./use-navigation'
;
function
useMixedMenu
()
{
function
useMixedMenu
()
{
const
{
navigation
}
=
useNavigation
();
const
{
navigation
,
willOpenedByWindow
}
=
useNavigation
();
const
accessStore
=
useAccessStore
();
const
accessStore
=
useAccessStore
();
const
route
=
useRoute
();
const
route
=
useRoute
();
const
splitSideMenus
=
ref
<
MenuRecordRaw
[]
>
([]);
const
splitSideMenus
=
ref
<
MenuRecordRaw
[]
>
([]);
...
@@ -89,11 +89,15 @@ function useMixedMenu() {
...
@@ -89,11 +89,15 @@ function useMixedMenu() {
navigation
(
key
);
navigation
(
key
);
return
;
return
;
}
}
const
rootMenu
=
menus
.
value
.
find
((
item
)
=>
item
.
path
===
key
);
const
rootMenu
=
menus
.
value
.
find
((
item
)
=>
item
.
path
===
key
);
rootMenuPath
.
value
=
rootMenu
?.
path
??
''
;
const
_splitSideMenus
=
rootMenu
?.
children
??
[];
splitSideMenus
.
value
=
rootMenu
?.
children
??
[];
if
(
splitSideMenus
.
value
.
length
===
0
)
{
if
(
!
willOpenedByWindow
(
key
))
{
rootMenuPath
.
value
=
rootMenu
?.
path
??
''
;
splitSideMenus
.
value
=
_splitSideMenus
;
}
if
(
_splitSideMenus
.
length
===
0
)
{
navigation
(
key
);
navigation
(
key
);
}
else
if
(
rootMenu
&&
preferences
.
sidebar
.
autoActivateChild
)
{
}
else
if
(
rootMenu
&&
preferences
.
sidebar
.
autoActivateChild
)
{
navigation
(
navigation
(
...
...
packages/effects/layouts/src/basic/menu/use-navigation.ts
View file @
384c5d7
...
@@ -29,7 +29,19 @@ function useNavigation() {
...
@@ -29,7 +29,19 @@ function useNavigation() {
}
}
};
};
return
{
navigation
};
const
willOpenedByWindow
=
(
path
:
string
)
=>
{
const
route
=
routeMetaMap
.
get
(
path
);
const
{
openInNewWindow
=
false
}
=
route
?.
meta
??
{};
if
(
isHttpUrl
(
path
))
{
return
true
;
}
else
if
(
openInNewWindow
)
{
return
true
;
}
else
{
return
false
;
}
};
return
{
navigation
,
willOpenedByWindow
};
}
}
export
{
useNavigation
};
export
{
useNavigation
};
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment