Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1
Overview
Overview
Details
Activity
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
吴迪
gs1
Commits
e950a68d
Commit
e950a68d
authored
Oct 03, 2021
by
Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 侧边栏功能优化
parent
bfd2ab18
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
40 deletions
+82
-40
index.vue
src/components/layout/header/index.vue
+1
-1
mock.js
src/components/layout/header/mock.js
+1
-1
SubNav.vue
src/views/comps/SubNav.vue
+80
-38
No files found.
src/components/layout/header/index.vue
View file @
e950a68d
...
@@ -87,7 +87,7 @@ export default {
...
@@ -87,7 +87,7 @@ export default {
if
(
this
.
$route
.
path
.
startsWith
(
nav_
.
link
))
{
if
(
this
.
$route
.
path
.
startsWith
(
nav_
.
link
))
{
this
.
currentNav
=
nav_
.
id
;
this
.
currentNav
=
nav_
.
id
;
nav_
.
children
&&
nav_
.
children
&&
nav_
.
children
.
le
gn
th
>
0
&&
nav_
.
children
.
le
ng
th
>
0
&&
this
.
$store
.
commit
(
"system/SET_SUB_NAV"
,
nav_
.
children
);
this
.
$store
.
commit
(
"system/SET_SUB_NAV"
,
nav_
.
children
);
if
(
nav_
.
link
===
this
.
$route
.
path
)
{
if
(
nav_
.
link
===
this
.
$route
.
path
)
{
nav_
.
breadcrumb
&&
nav_
.
breadcrumb
&&
...
...
src/components/layout/header/mock.js
View file @
e950a68d
...
@@ -40,7 +40,7 @@ export const nav = [
...
@@ -40,7 +40,7 @@ export const nav = [
id
:
"2"
,
id
:
"2"
,
name
:
"业务大厅"
,
name
:
"业务大厅"
,
index
:
2
,
index
:
2
,
link
:
"/
bui
ss"
,
link
:
"/
Busine
ss"
,
children
:
[],
children
:
[],
},
},
{
{
...
...
src/views/comps/SubNav.vue
View file @
e950a68d
<
template
>
<
template
>
<el-menu
<el-menu
:default-active=
"activeMenu"
:default-active=
"activeMenu"
class=
"el-menu-vertical gs-subnav"
class=
"el-menu-vertical gs-subnav"
:collapse=
"false"
:collapse=
"false"
@
select=
"handleSelect"
@
select=
"handleSelect"
>
>
<template
v-for=
"submenu in subNav"
>
<template
v-for=
"submenu in subNav"
>
<el-submenu
<el-submenu
v-if=
"submenu.children && submenu.children.length > 0"
v-if=
"submenu.children && submenu.children.length > 0"
:key=
"submenu.id"
:key=
"submenu.id"
:index=
"submenu.name"
:index=
"submenu.name"
>
>
<template
slot=
"title"
>
<template
slot=
"title"
>
<span
style=
"margin-left: 6px"
>
{{
submenu
.
name
}}
</span>
<span>
{{
submenu
.
name
}}
</span>
</
template
>
</
template
>
<
template
v-for=
"item in submenu.children"
>
<
template
v-for=
"item in submenu.children"
>
<template
v-if=
"item.children && item.children.length > 0"
>
<template
v-if=
"item.children && item.children.length > 0"
>
<el-submenu
<el-submenu
:index=
"item.name"
:index=
"item.name"
:key=
"item.id"
:key=
"item.id"
:background-color=
"theme.subMenuBg"
:text-color=
"theme.menuText"
:active-text-color=
"theme.menuActiveText"
>
>
<template
slot=
"title"
>
<template
slot=
"title"
>
<i
v-show=
"item.icon_name"
:style=
"
{ color: theme.menuText }"
style="font-size: 13px"
:class="['qycloud', `${item.icon_name}`]"
/>
<span
style=
"margin-left: 6px"
>
{{
item
.
name
}}
</span>
<span
style=
"margin-left: 6px"
>
{{
item
.
name
}}
</span>
</
template
>
</
template
>
<
template
v-for=
"third in item.children"
>
<
template
v-for=
"third in item.children"
>
<el-menu-item
<el-menu-item
:key=
"third.id"
:key=
"third.id"
:index=
"third.name"
:index=
"third.name"
:class=
"
{ 'is-active': activeMenu === third.id }"
:class=
"
{ 'is-active': activeMenu === third.id }"
>
>
{{
third
.
name
}}
{{
third
.
name
}}
</el-menu-item>
</el-menu-item>
</
template
>
</
template
>
</el-submenu>
</el-submenu>
</template>
</template>
<
template
v-else
>
<
template
v-else
>
<el-menu-item
<el-menu-item
:key=
"item.id"
:key=
"item.id"
:index=
"item.name"
:index=
"item.name"
:class=
"
{ 'is-active': activeMenu === item.id }"
:class=
"
{ 'is-active': activeMenu === item.id }"
>
>
{{
item
.
name
}}
{{
item
.
name
}}
</el-menu-item>
</el-menu-item>
...
@@ -57,17 +47,10 @@
...
@@ -57,17 +47,10 @@
</el-submenu>
</el-submenu>
<
template
v-else
>
<
template
v-else
>
<el-menu-item
<el-menu-item
:key=
"submenu.id"
:key=
"submenu.id"
:index=
"submenu.name"
:index=
"submenu.name"
:class=
"
{ 'is-active': activeMenu === submenu.id }"
:class=
"
{ 'is-active': activeMenu === submenu.id }"
>
>
{{
submenu
.
name
}}
<i
v-show=
"submenu.icon_name"
:style=
"
{ color: theme.menuText }"
style="font-size: 13px;margin-right: 6px"
:class="['qycloud', `${submenu.icon_name}`]"
/>
<span>
{{
submenu
.
name
}}
</span>
<span>
{{
submenu
.
name
}}
</span>
</el-menu-item>
</el-menu-item>
</
template
>
</
template
>
...
@@ -75,12 +58,12 @@
...
@@ -75,12 +58,12 @@
</el-menu>
</el-menu>
</template>
</template>
<
script
>
<
script
>
import
{
mapState
}
from
"vuex"
;
import
{
mapState
}
from
"vuex"
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
defaultOpeneds
:
[
"1"
,
"2"
]
,
activeMenu
:
''
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -90,6 +73,60 @@ export default {
...
@@ -90,6 +73,60 @@ export default {
console
.
log
(
this
.
subNav
);
console
.
log
(
this
.
subNav
);
},
},
methods
:
{
methods
:
{
handleSelect
(
index
,
indexP
)
{
console
.
log
(
index
,
indexP
);
const
temp
=
JSON
.
parse
(
JSON
.
stringify
(
indexP
));
const
key
=
temp
.
shift
();
this
.
subNav
.
forEach
((
item
)
=>
{
if
(
item
.
name
===
key
)
{
if
(
temp
.
length
>
1
)
{
this
.
checkChildren
(
index
,
temp
,
item
.
children
);
}
else
if
(
temp
.
length
===
0
)
{
this
.
activeMenu
=
item
.
name
;
this
.
showApp
(
item
);
}
else
{
item
.
children
.
forEach
((
_item
)
=>
{
if
(
_item
.
name
===
index
)
{
this
.
activeMenu
=
_item
.
name
;
this
.
showApp
(
_item
);
}
});
}
}
});
},
checkChildren
(
index
,
indexP
,
list
)
{
const
key
=
indexP
.
shift
();
list
.
forEach
((
item
)
=>
{
console
.
log
(
key
);
if
(
item
.
name
===
key
)
{
if
(
indexP
.
length
>
1
)
{
this
.
checkChildren
(
index
,
indexP
,
item
.
children
);
}
else
{
item
.
children
.
forEach
((
_item
)
=>
{
if
(
_item
.
name
===
index
)
{
this
.
activeMenu
=
_item
.
name
;
this
.
showApp
(
_item
);
}
});
}
}
});
},
showApp
(
item
)
{
console
.
log
(
item
)
if
(
item
.
link
.
startsWith
(
'http'
)){
window
.
open
(
item
.
link
)
}
else
{
if
(
item
.
breadcrumb
)
{
this
.
$store
.
commit
(
'system/SET_BREADCRUMB'
,
item
.
breadcrumb
)
}
this
.
$router
.
push
({
path
:
item
.
link
})
}
},
handleOpen
(
key
,
keyPath
)
{
handleOpen
(
key
,
keyPath
)
{
console
.
log
(
key
,
keyPath
);
console
.
log
(
key
,
keyPath
);
},
},
...
@@ -103,11 +140,13 @@ export default {
...
@@ -103,11 +140,13 @@ export default {
.el-menu.gs-subnav
{
.el-menu.gs-subnav
{
border-right
:
none
;
border-right
:
none
;
background
:
$
side-bg-color
;
background
:
$
side-bg-color
;
.el-submenu__title
{
.el-submenu__title
{
background
:
$
side-bg-color
;
background
:
$
side-bg-color
;
height
:
44px
;
height
:
44px
;
line-height
:
44px
;
line-height
:
44px
;
}
}
.menu-title
{
.menu-title
{
margin-top
:
25px
;
margin-top
:
25px
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
...
@@ -115,12 +154,14 @@ export default {
...
@@ -115,12 +154,14 @@ export default {
font-size
:
14px
;
font-size
:
14px
;
color
:
#b7b6b6
;
color
:
#b7b6b6
;
}
}
.el-menu-item
{
.el-menu-item
{
height
:
44px
;
height
:
44px
;
line-height
:
44px
;
line-height
:
44px
;
color
:
#6b6a6a
;
color
:
#6b6a6a
;
background
:
transparent
;
background
:
transparent
;
font-size
:
14px
;
font-size
:
14px
;
i
{
i
{
color
:
$
side-bg-color
;
color
:
$
side-bg-color
;
font-size
:
25px
;
font-size
:
25px
;
...
@@ -128,6 +169,7 @@ export default {
...
@@ -128,6 +169,7 @@ export default {
top
:
15px
;
top
:
15px
;
right
:
15px
;
right
:
15px
;
}
}
&
:hover
,
&
:hover
,
&
:focus
,
&
:focus
,
&
.is-active
{
&
.is-active
{
...
...
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