Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
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 dec9a7c1
authored
Sep 15, 2023
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
调整左侧菜单细节
1 parent
7874b383
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
63 deletions
src/assets/style/mixins.scss
src/assets/style/variables.scss.js
src/layout/components/LeftSide/LeftSideIndex.vue
src/layout/components/LeftSide/LeftSideMenuLv1.vue
src/layout/components/LeftSide/LeftSideMenuLv1Item.vue
src/layout/components/LeftSide/LeftSideMenuLv2.vue
src/layout/components/LeftSide/LeftSideMenuLv2Item.vue
src/layout/components/LeftSide/LeftSideMenuLv3.vue
src/assets/style/mixins.scss
View file @
dec9a7c
...
...
@@ -11,7 +11,7 @@
@mixin
menu-highlight
{
outline
:
0
!
important
;
color
:
$main-color
!
important
;
background-color
:
rgba
(
88
,
80
,
255
,
0
.2
)
!
important
;
background-color
:
#EDECFF
!
important
;
border-bottom
:
none
;
}
src/assets/style/variables.scss.js
View file @
dec9a7c
...
...
@@ -23,6 +23,7 @@ module.exports = {
header_color
:
'#fff'
,
header_padding
:
'15px'
,
logo_height
:
'70px'
,
logo_menu_gap
:
'36px'
,
// 左侧菜单样式变量
menu_background
:
'#2a3f54'
,
menu_color
:
'#fff'
,
...
...
src/layout/components/LeftSide/LeftSideIndex.vue
View file @
dec9a7c
<
template
>
<div
class=
"side-bar"
>
<div
class=
"side-bar"
@
mouseleave
.
stop=
"mouseleave"
>
<div
class=
"logo"
>
<Logo></Logo>
</div>
...
...
@@ -11,21 +11,13 @@
</
template
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
{
mapGetters
}
from
'vuex'
import
Vue
from
'vue'
const
bus
=
new
Vue
()
export
default
{
name
:
'LeftSideMenu'
,
computed
:
{
...
mapGetters
([
'app'
])
},
watch
:
{
'app.currentPage.id'
:
{
handler
(
n
)
{
const
[
lv1
,
lv2
,
lv3
,
lv4
]
=
n
.
split
(
'-'
)
bus
.
$emit
(
'current'
,
{
lv1
,
lv2
,
lv3
,
lv4
})
}
}
...
mapGetters
([
'app'
,
'menu'
])
},
data
()
{
return
{
...
...
@@ -39,6 +31,11 @@ export default {
return
{
bus
}
},
methods
:
{
mouseleave
:
function
()
{
!
this
.
menu
.
isCollapse
&&
bus
.
$emit
(
'menuChanged'
,
{
isReload
:
true
})
}
}
}
</
script
>
...
...
@@ -54,35 +51,24 @@ export default {
>
.logo
{
flex
:
0
0
$
logo-height
;
height
:
$
logo-height
;
z-index
:
112
;
}
.side-bar-menu
{
flex
:
1
;
user-select
:
none
;
overflow
-y
:
auto
;
overflow
:
hidden
;
background-color
:
#fff
;
padding-top
:
36px
;
display
:
flex
;
&-left
{
height
:
100%
;
width
:
$
menu-width
;
.el-menu
{
height
:
100%
;
}
}
&
-scroll-y
{
/deep/.el-scrollbar__wrap
{
margin-bottom
:
0
!important
;
}
height
:
calc
(
100vh
-
#
{
$logo-height
}
);
}
}
&
::before
{
position
:
absolute
;
content
:
''
;
width
:
1px
;
width
:
0
;
border-right
:
1px
solid
#f5f7fa
;
height
:
100%
;
left
:
48px
;
left
:
47px
;
z-index
:
111
;
}
}
</
style
>
src/layout/components/LeftSide/LeftSideMenuLv1.vue
View file @
dec9a7c
<
template
>
<div
class=
"com-left-side-menu-lv1"
>
<GLScroll
class=
"side-bar-menu-scroll-y"
>
<LeftSideMenuLv1Item
v-for=
"item in menuList"
:key=
"item.id"
:menuData=
"item"
></LeftSideMenuLv1Item>
<div
class=
"menu-lv1-item-wrap"
>
<LeftSideMenuLv1Item
v-for=
"item in menuList"
:key=
"item.id"
:menuData=
"item"
></LeftSideMenuLv1Item>
</div>
</GLScroll>
<el-popover
v-if=
"showPop && menu.isCollapse"
ref=
"pop"
:reference=
"reference"
placement=
"right-start"
:visible-arrow=
"false"
width=
"160"
trigger=
"hover"
popper-class=
"el-submenu-popper-base"
>
<LeftSideMenuLv2></LeftSideMenuLv2>
...
...
@@ -31,9 +33,7 @@ export default {
return
{
reference
:
{},
// 控制渲染条件
showPop
:
false
,
// 保存当前激活的refrence id
activeId
:
''
showPop
:
false
}
},
mounted
()
{
...
...
@@ -43,12 +43,8 @@ export default {
this
.
bus
.
$off
(
'mouseenter'
,
this
.
mouseenter
)
},
methods
:
{
mouseenter
(
item
,
reference
,
onReady
)
{
// 这个操作是为了避免与源码中的 doToggle方法冲突
// if (this.activeId === item.id && this.showPop) return
mouseenter
(
reference
,
onReady
)
{
this
.
showPop
=
false
this
.
activeId
=
item
.
id
// 因为reference是需要获取dom的引用 所以需要是$el
this
.
reference
=
reference
this
.
$nextTick
(()
=>
{
// 等待显示的popover销毁后再 重新渲染新的popover
...
...
@@ -75,7 +71,9 @@ $width: 160px;
padding
:
0px
!important
;
margin-left
:
0px
;
box-shadow
:
0
6px
20px
0
#7a7a7a33
;
border-radius
:
4px
;
>
.com-left-side-menu-lv2
{
border-radius
:
4px
;
}
}
//
}
</
style
>
...
...
@@ -83,10 +81,17 @@ $width: 160px;
.com-left-side-menu-lv1
{
width
:
48px
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
box-sizing
:
border-box
;
.side-bar-menu-scroll-y
{
/deep/.el-scrollbar__wrap
{
margin-bottom
:
0
!important
;
}
height
:
calc
(
100vh
-
#
{
$logo-height
+
36px
}
);
}
//
border-right
:
1px
solid
#f5f7fa
;
.menu-lv1-item-wrap
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
}
}
</
style
>
src/layout/components/LeftSide/LeftSideMenuLv1Item.vue
View file @
dec9a7c
...
...
@@ -7,6 +7,7 @@
<
script
>
import
{
mapActions
,
mapGetters
}
from
'vuex'
// import { utils } from 'glsx-common'
export
default
{
name
:
'LeftSideMenuLv1Item'
,
inject
:
[
'bus'
],
...
...
@@ -29,13 +30,13 @@ export default {
mouseenter
:
function
()
{
if
(
this
.
menu
.
hoverId
===
this
.
menu
.
id
)
return
this
.
setHoverId
(
this
.
menuData
.
id
)
this
.
menu
.
isCollapse
&&
this
.
bus
.
$emit
(
'mouseenter'
,
this
.
menuData
,
this
.
$refs
[
'bt'
+
this
.
menuData
.
id
],
()
=>
this
.
bus
.
$emit
(
'menuChanged'
,
this
.
menuData
.
children
.
noHidden
()
))
this
.
menu
.
isCollapse
&&
this
.
bus
.
$emit
(
'mouseenter'
,
this
.
$refs
[
'bt'
+
this
.
menuData
.
id
],
()
=>
this
.
bus
.
$emit
(
'menuChanged'
,
{
menus
:
this
.
menuData
.
children
.
noHidden
()
}
))
},
mouseleave
:
function
()
{
this
.
menu
.
hoverId
&&
this
.
setHoverId
(
''
)
this
.
setHoverId
(
''
)
},
handleClick
()
{
this
.
bus
.
$emit
(
'menuChanged'
,
this
.
menuData
.
children
.
noHidden
()
)
this
.
bus
.
$emit
(
'menuChanged'
,
{
menus
:
this
.
menuData
.
children
.
noHidden
()
}
)
},
...
mapActions
(
'menu'
,
[
'setHoverId'
])
}
...
...
src/layout/components/LeftSide/LeftSideMenuLv2.vue
View file @
dec9a7c
...
...
@@ -51,7 +51,8 @@ export default {
handleCurrentChange
({
lv1
,
lv2
,
lv3
})
{
this
.
cur
.
active
=
`
${
lv1
}
-
${
lv2
}
-
${
lv3
}
`
},
handleMenuChanged
(
menus
)
{
handleMenuChanged
({
menus
,
isReload
})
{
if
(
isReload
)
return
this
.
cur
.
openeds
=
menus
.
map
(({
id
})
=>
id
)
}
}
...
...
src/layout/components/LeftSide/LeftSideMenuLv2Item.vue
View file @
dec9a7c
<
template
>
<div
class=
"com-left-side-menu-lv2-item"
>
<div
v-for=
"item in menus"
:key=
"item.id"
>
<!-- 没有
二级菜单的一
级菜单 -->
<!-- 没有
三级级菜单的二
级菜单 -->
<div
class=
"el-submenu"
:class=
"
{ active: `${current.lv1}-${current.lv2}` == item.id }" v-if="isMenuNoChildren(item)" @click.stop="handleModuleClick(item)">
<div
class=
"el-submenu__title"
>
<span>
{{
item
.
title
}}
</span>
</div>
</div>
<!-- 有
二级菜单的一
级菜单 -->
<el-submenu
v-else
:index=
"item.id"
popper-class=
"el-submenu-popper-base"
:hide-timeout=
"hideTimeout"
:show-timeout=
"showTimeout"
>
<!-- 有
三级菜单的二
级菜单 -->
<el-submenu
v-else
:index=
"item.id"
popper-class=
"el-submenu-popper-base"
>
<span
slot=
"title"
>
{{
item
.
title
}}
</span>
<!-- 渲染
二
级菜单 -->
<LeftSideMenuLv3
:menuItems=
"item.children"
:parentTitle=
"item.title"
></LeftSideMenuLv3>
<!-- 渲染
三
级菜单 -->
<LeftSideMenuLv3
:menuItems=
"item.children"
></LeftSideMenuLv3>
</el-submenu>
</div>
</div>
...
...
@@ -26,9 +26,7 @@ export default {
inject
:
[
'bus'
],
data
()
{
return
{
menus
:
[],
showTimeout
:
0
,
hideTimeout
:
0
menus
:
[]
}
},
computed
:
{
...
...
@@ -55,13 +53,17 @@ export default {
isMenuNoChildren
({
children
=
[]
})
{
return
children
.
noHidden
().
length
==
0
},
handleMenuChanged
(
menus
)
{
handleMenuChanged
({
menus
,
isReload
=
false
})
{
if
(
isReload
)
{
this
.
reload
()
return
}
this
.
menus
=
menus
},
reload
()
{
const
{
lv1
}
=
this
.
current
this
.
menus
=
this
.
app
.
menuList
.
find
(({
id
})
=>
id
==
lv1
).
children
.
noHidden
()
this
.
bus
.
$emit
(
'menuChanged'
,
this
.
menus
)
const
menus
=
this
.
app
.
menuList
.
find
(({
id
})
=>
id
==
lv1
).
children
.
noHidden
()
this
.
bus
.
$emit
(
'menuChanged'
,
{
menus
}
)
}
}
}
...
...
src/layout/components/LeftSide/LeftSideMenuLv3.vue
View file @
dec9a7c
<
template
>
<el-menu-item-group
:title=
"parentTitle"
class=
"com-left-side-menu-lv3"
v-if=
"menuItems"
>
<el-menu-item-group
class=
"com-left-side-menu-lv3"
v-if=
"menuItems"
>
<el-menu-item
v-for=
"item in menuItems.noHidden()"
:key=
"item.id"
:index=
"item.id"
@
click
.
native
.
stop=
"handleSelect(item)"
>
<span>
{{
item
.
title
}}
</span>
</el-menu-item>
...
...
@@ -10,11 +10,6 @@
export
default
{
name
:
'LeftSideMenuLv3'
,
props
:
{
parentTitle
:
{
type
:
String
,
required
:
false
,
default
:
''
},
menuItems
:
{
type
:
Array
,
required
:
true
...
...
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