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
af65eb0c
Commit
af65eb0c
authored
Jan 09, 2022
by
ahxiangkui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
liwj提交
parent
1e48b5de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
40 deletions
+73
-40
index.vue
src/components/layout/englishHeader/index.vue
+73
-40
No files found.
src/components/layout/englishHeader/index.vue
View file @
af65eb0c
...
@@ -14,10 +14,10 @@
...
@@ -14,10 +14,10 @@
<ul
class=
"navbar-nav"
>
<ul
class=
"navbar-nav"
>
<!-- Nav items-->
<!-- Nav items-->
<template
v-for=
"nav in navList"
>
<template
v-for=
"nav in navList"
>
<li
v-if=
"nav.children && nav.children.length > 0"
class=
"gs-nav-item nav-item"
:key=
"nav.id
"
<li
v-if=
"nav.children && nav.children.length > 0"
@
click=
"handleNavClick(nav, $event)
"
:class=
"
{ active: currentNav === nav.id }" @click="handleNavClick(nav, $event)">
class=
"gs-nav-item nav-item"
:class=
"
{show_dropdown:showDropDown===nav.id}"
<a
:id=
"`gs-nav-item-$
{nav.id}`" class="nav-link" aria-current="page" href="javascript:void(0)"
:active_nav="currentNav === nav.id" :key="nav.id">
role="button" data-bs-toggle="dropdown" aria-expanded="false
">
{{
nav
.
name
}}
</a>
<a
:id=
"`gs-nav-item-$
{nav.id}`" class="nav-link" href="javascript:void(0)
">
{{
nav
.
name
}}
</a>
<i
class=
"mobile-menu-down bi bi-chevron-compact-down"
></i>
<i
class=
"mobile-menu-down bi bi-chevron-compact-down"
></i>
<!-- Dropdown Menu -->
<!-- Dropdown Menu -->
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
<!-- End Dropdown Menu -->
<!-- End Dropdown Menu -->
</li>
</li>
<li
v-else
:key=
"nav.id"
@
click=
"handleNavClick(nav, $event)"
class=
"gs-nav-item nav-item"
<li
v-else
:key=
"nav.id"
@
click=
"handleNavClick(nav, $event)"
class=
"gs-nav-item nav-item"
:
class=
"
{ active: currentNav === nav.id }
">
:
active_nav=
"currentNav === nav.id
"
>
<a
class=
"nav-link"
href=
"javascript:void(0)"
>
{{
<a
class=
"nav-link"
href=
"javascript:void(0)"
>
{{
nav
.
name
nav
.
name
}}
</a>
}}
</a>
</li>
</li>
</
template
>
</
template
>
...
@@ -62,40 +62,31 @@ export default {
...
@@ -62,40 +62,31 @@ export default {
fromNav
:
false
,
fromNav
:
false
,
// 点击事件来自dropdown
// 点击事件来自dropdown
fromDropdown
:
false
,
fromDropdown
:
false
,
navList
:
nav
,
currentNav
:
"0"
,
currentNav
:
"0"
,
preActive
:
""
,
preActive
:
""
,
showDropDown
:
''
,
};
};
},
},
created
()
{
watch
:
{
// 监听路由 处理nav高亮 和面包屑 和subnav
$route
:
{
nav
.
forEach
((
nav_
)
=>
{
handler
()
{
if
(
this
.
$route
.
path
.
startsWith
(
nav_
.
link
))
{
this
.
initNav
();
this
.
currentNav
=
nav_
.
id
;
},
deep
:
true
,
// nav_.children &&
immediate
:
true
,
// nav_.children.length > 0 &&
}
// this.$store.commit("system/SET_SUB_NAV", nav_.children);
},
// console.log(nav_, this.$route, 'this.$route.path');
computed
:
{
if
(
nav_
.
link
===
this
.
$route
.
path
)
{
navList
()
{
nav_
.
breadcrumb
&&
let
list
=
[];
this
.
$store
.
commit
(
"system/SET_BREADCRUMB"
,
nav_
.
breadcrumb
);
nav
.
forEach
(
el
=>
{
}
else
{
if
(
!
el
.
isHiddenMenu
)
{
// TODO 去dropdown里面精确查找当前的路径
list
.
push
(
el
);
let
result
;
result
=
deepFindBreadcrumb
(
nav_
.
children
,
this
.
$route
.
path
);
// console.log(this.$route.path, result, 'resultresultresult');
if
(
result
.
length
===
0
&&
Object
.
keys
(
this
.
$route
.
query
).
length
>
0
)
{
const
queryString
=
Qs
.
stringify
(
cleanObject
(
this
.
$route
.
query
));
let
path
=
`
${
this
.
$route
.
path
}
?
${
queryString
}
`
;
result
=
deepFindBreadcrumb
(
nav_
.
children
,
path
);
}
result
&&
result
.
breadcrumb
&&
this
.
$store
.
commit
(
"system/SET_BREADCRUMB"
,
result
.
breadcrumb
);
}
}
}
})
});
return
list
;
// return nav;
}
},
},
mounted
()
{
mounted
()
{
window
.
addEventListener
(
"click"
,
this
.
handleWindowClick
);
window
.
addEventListener
(
"click"
,
this
.
handleWindowClick
);
...
@@ -104,8 +95,41 @@ export default {
...
@@ -104,8 +95,41 @@ export default {
window
.
removeEventListener
(
"click"
,
this
.
handleWindowClick
);
window
.
removeEventListener
(
"click"
,
this
.
handleWindowClick
);
},
},
methods
:
{
methods
:
{
// 监听路由 处理nav高亮 和面包屑 和subnav
initNav
()
{
nav
.
forEach
((
nav_
)
=>
{
if
(
this
.
$route
.
path
.
startsWith
(
nav_
.
link
))
{
this
.
currentNav
=
nav_
.
id
;
// nav_.children &&
// nav_.children.length > 0 &&
// this.$store.commit("system/SET_SUB_NAV", nav_.children);
// console.log(nav_, this.$route, 'this.$route.path');
if
(
nav_
.
link
===
this
.
$route
.
path
)
{
nav_
.
breadcrumb
&&
this
.
$store
.
commit
(
"system/SET_BREADCRUMB"
,
nav_
.
breadcrumb
);
}
else
{
// TODO 去dropdown里面精确查找当前的路径
let
result
;
result
=
deepFindBreadcrumb
(
nav_
.
children
,
this
.
$route
.
path
);
// console.log(this.$route.path, result, 'resultresultresult');
if
(
result
.
length
===
0
&&
Object
.
keys
(
this
.
$route
.
query
).
length
>
0
)
{
const
queryString
=
Qs
.
stringify
(
cleanObject
(
this
.
$route
.
query
));
let
path
=
`
${
this
.
$route
.
path
}
?
${
queryString
}
`
;
result
=
deepFindBreadcrumb
(
nav_
.
children
,
path
);
}
result
&&
result
.
breadcrumb
&&
this
.
$store
.
commit
(
"system/SET_BREADCRUMB"
,
result
.
breadcrumb
);
}
}
});
},
handleWindowClick
()
{
handleWindowClick
()
{
// console.log('handleWindowClick', this.fromNav, this.preActive);
console
.
log
(
'handleWindowClick'
,
this
.
fromNav
,
this
.
preActive
);
if
(
!
this
.
fromNav
)
{
this
.
showDropDown
=
''
}
if
(
this
.
preActive
&&
!
this
.
fromNav
)
{
if
(
this
.
preActive
&&
!
this
.
fromNav
)
{
this
.
currentNav
=
this
.
preActive
;
this
.
currentNav
=
this
.
preActive
;
this
.
preActive
=
""
;
this
.
preActive
=
""
;
...
@@ -115,6 +139,8 @@ export default {
...
@@ -115,6 +139,8 @@ export default {
},
},
handleNavClick
(
nav
)
{
handleNavClick
(
nav
)
{
console
.
log
(
'handleNavClick'
,
nav
)
this
.
showDropDown
=
nav
.
id
;
if
(
nav
.
linkFlag
==
1
)
{
if
(
nav
.
linkFlag
==
1
)
{
window
.
open
(
nav
.
link
);
window
.
open
(
nav
.
link
);
}
else
if
(
!
nav
.
children
||
nav
.
children
.
length
===
0
)
{
}
else
if
(
!
nav
.
children
||
nav
.
children
.
length
===
0
)
{
...
@@ -190,7 +216,7 @@ export default {
...
@@ -190,7 +216,7 @@ export default {
//
导航
item
样式
//
导航
item
样式
.gs-nav-item.nav-item
{
.gs-nav-item.nav-item
{
&
.active
>
a,
&
[active_nav="true"]
>
a,
a.show
{
a.show
{
color
:
#f26335
;
color
:
#f26335
;
...
@@ -260,6 +286,10 @@ export default {
...
@@ -260,6 +286,10 @@ export default {
}
}
}
}
.show_dropdown
.dropdown-menu
{
display
:
block
;
}
@media
(
max-width
:
1400px
)
{
@media
(
max-width
:
1400px
)
{
//
导航
item
边距
//
导航
item
边距
//
.gs-header-nav
.gs-nav-item.nav-item
{
//
.gs-header-nav
.gs-nav-item.nav-item
{
...
@@ -292,10 +322,12 @@ export default {
...
@@ -292,10 +322,12 @@ export default {
.gs-header-nav
.gs-nav-item.nav-item
{
.gs-header-nav
.gs-nav-item.nav-item
{
position
:
relative
;
position
:
relative
;
>
a
{
>
a
{
width
:
100%
;
width
:
100%
;
}
}
&
.active
>
a
,
&[
active_nav
=
"true"
]
>
a
,
a
.show
{
a
.show
{
color
:
#f26335
;
color
:
#f26335
;
...
@@ -306,7 +338,8 @@ export default {
...
@@ -306,7 +338,8 @@ export default {
}
}
}
}
.gs-header-nav
.gs-nav-item.nav-item.active
.mobile-menu-down
{
.gs-header-nav
.gs-nav-item.nav-item.active_nav
.mobile-menu-down
,
.gs-header-nav
.gs-nav-item.nav-item.show
.mobile-menu-down
{
transform
:
rotate
(
180deg
);
transform
:
rotate
(
180deg
);
}
}
...
...
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