明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jt_front
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
jt_front
Commits
5765b85b
Commit
5765b85b
authored
Mar 18, 2026
by
zhanghan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决左侧图标问题
parent
850d0bed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
43 deletions
+95
-43
MainLayout.vue
src/layouts/MainLayout.vue
+18
-3
leftMenu.vue
src/layouts/leftMenu.vue
+35
-18
leftMenuItem.vue
src/layouts/leftMenuItem.vue
+42
-22
No files found.
src/layouts/MainLayout.vue
View file @
5765b85b
...
...
@@ -231,27 +231,42 @@ const handleLogout = () => {
color: #666;
font-size: 14px;
background-color: #fff;
height: 40px;
line-height: 40px;
}
::v-deep .el-sub-menu {
color: #666;
font-size: 14px;
background-color: #fff;
.el-sub-menu__title {
height: 100%;
height: 40px;
line-height: 40px;
}
}
:deep(.el-menu-item.is-active) {
color: #0084ff;
border-right: 4px solid #3d84ee;
background-color: #f1f7ff;
}
/* 子菜单被激活时,父菜单也高亮 */
:deep(.el-sub-menu.is-active > .el-sub-menu__title) {
color: #0084ff !important;
// background-color: #b3d7ff !important;
}
/* 完全去掉系统管理子菜单的背景色 */
:deep(.el-sub-menu__title) {
color: #666;
background-color: #fff !important;
}
/* 图标样式 */
:deep(.el-menu-item .el-icon),
:deep(.el-sub-menu__title .el-icon) {
font-size: 14px;
margin-right: 8px;
}
.city-header {
width: 100%;
height: 48px;
...
...
@@ -315,7 +330,7 @@ const handleLogout = () => {
.city-aside {
background-color: #fff;
width: 2
4
0px;
width: 2
1
0px;
height: 100%;
box-shadow: 0 6px 10px 0 rgba(36, 36, 63, 0.05);
overflow: auto;
...
...
src/layouts/leftMenu.vue
View file @
5765b85b
<
template
>
<el-menu
:default-active=
"$route.path"
router
>
<template
v-for=
"item in menuList"
>
<template
v-if=
"item.children && item.children.length"
>
<left-menu-item
:key=
"item.id?.toString()"
:menuItem=
"item"
></left-menu-item>
</
template
>
<
template
v-else
>
<el-menu-item
:key=
"item.id?.toString()"
:index=
"item.url"
>
<span>
{{
item
.
name
}}
</span>
</el-menu-item>
</
template
>
</template>
</el-menu>
<el-menu
:default-active=
"$route.path"
router
>
<template
v-for=
"item in menuList"
>
<template
v-if=
"item.children && item.children.length"
>
<left-menu-item
:key=
"item.id?.toString()"
:menuItem=
"item"
></left-menu-item>
</
template
>
<
template
v-else
>
<el-menu-item
:key=
"item.id?.toString()"
:index=
"item.url"
>
<el-icon><component
:is=
"getIcon(item.name)"
/></el-icon>
<span>
{{
item
.
name
}}
</span>
</el-menu-item>
</
template
>
</template>
</el-menu>
</template>
<
script
setup
>
import
LeftMenuItem
from
"./leftMenuItem.vue"
;
const
menuList
=
sessionStorage
.
getItem
(
"userInfo"
)
?
JSON
.
parse
(
sessionStorage
.
getItem
(
"userInfo"
)).
menus
:
[];
import
LeftMenuItem
from
"./leftMenuItem.vue"
;
import
*
as
Icons
from
"@element-plus/icons-vue"
;
const
menuList
=
sessionStorage
.
getItem
(
"userInfo"
)
?
JSON
.
parse
(
sessionStorage
.
getItem
(
"userInfo"
)).
menus
:
[];
// 根据菜单名称获取对应图标
const
getIcon
=
(
name
)
=>
{
const
iconMap
=
{
数据大屏
:
"DataLine"
,
消息中心
:
"Bell"
,
模板管理
:
"MagicStick"
,
};
const
iconName
=
iconMap
[
name
]
||
"Menu"
;
return
Icons
[
iconName
]
||
Icons
.
Menu
;
};
</
script
>
<
style
lang=
"less"
></
style
>
\ No newline at end of file
<
style
lang=
"less"
></
style
>
src/layouts/leftMenuItem.vue
View file @
5765b85b
<
template
>
<el-sub-menu
:index=
"menuItem.id?.toString()"
>
<template
#
title
>
<span>
{{
menuItem
.
name
}}
</span>
</
template
>
<
template
v-for=
"(child, index) in menuItem.children"
:key=
"index"
>
<left-menu-item
v-if=
"child.children && child.children.length"
></left-menu-item>
<el-menu-item
v-else
:index=
"child.url"
>
<span>
{{
child
.
name
}}
</span>
</el-menu-item>
</
template
>
</el-sub-menu>
<el-sub-menu
:index=
"menuItem.id?.toString()"
>
<template
#
title
>
<el-icon><component
:is=
"getIcon(menuItem.name)"
/></el-icon>
<span>
{{
menuItem
.
name
}}
</span>
</
template
>
<
template
v-for=
"(child, index) in menuItem.children"
:key=
"index"
>
<left-menu-item
v-if=
"child.children && child.children.length"
:menuItem=
"child"
></left-menu-item>
<el-menu-item
v-else
:index=
"child.url"
>
<span>
{{
child
.
name
}}
</span>
</el-menu-item>
</
template
>
</el-sub-menu>
</template>
<
script
setup
>
import
{
defineProps
}
from
'vue'
;
const
props
=
defineProps
({
menuItem
:
{
type
:
Object
,
default
:
{}
}
})
import
{
defineProps
}
from
"vue"
;
import
*
as
Icons
from
"@element-plus/icons-vue"
;
const
props
=
defineProps
({
menuItem
:
{
type
:
Object
,
default
:
{},
},
});
// 根据菜单名称获取对应图标(仅用于父菜单,子菜单不显示图标)
const
getIcon
=
(
name
)
=>
{
const
iconMap
=
{
系统管理
:
"Setting"
,
代码生成
:
"MagicStick"
,
投前管理
:
"Calendar"
,
投中管理
:
"Cloudy"
,
投后管理
:
"Wallet"
,
日常管理
:
"Document"
,
其他管理
:
"Files"
,
模板管理
:
"DocumentCopy"
,
};
const
iconName
=
iconMap
[
name
]
||
"Menu"
;
return
Icons
[
iconName
]
||
Icons
.
Menu
;
};
</
script
>
<
style
lang=
"less"
scoped
>
</
style
>
\ No newline at end of file
<
style
lang=
"less"
scoped
></
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment