Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
吕 成东
InzyCompanyPortal
Commits
6b1938ed
Commit
6b1938ed
authored
Jun 03, 2025
by
吕 成东
Browse files
修复 tabs 点击切换
parent
2ef555e6
Pipeline
#3083
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/components/Header.vue
View file @
6b1938ed
<
script
setup
lang=
"ts"
>
import
{
onMounted
}
from
'
vue
'
import
{
onMounted
,
ref
}
from
'
vue
'
import
{
useRouter
,
useRoute
}
from
'
vue-router
'
import
Swiper
from
'
swiper
'
import
{
Navigation
,
Pagination
,
Autoplay
}
from
'
swiper/modules
'
import
'
swiper/css
'
import
'
swiper/css/pagination
'
import
'
swiper/css/navigation
'
const
router
=
useRouter
()
const
route
=
useRoute
()
const
navItems
=
[
{
name
:
'
首 页
'
,
path
:
'
/
'
},
{
name
:
'
产品技术
'
,
path
:
'
/products
'
},
{
name
:
'
客户名录
'
,
path
:
'
/customers
'
},
{
name
:
'
新闻资讯
'
,
path
:
'
/news
'
},
{
name
:
'
加入我们
'
,
path
:
'
/join
'
},
{
name
:
'
关于我们
'
,
path
:
'
/about
'
}
]
const
handleNavClick
=
(
path
:
string
)
=>
{
router
.
push
(
path
)
}
onMounted
(()
=>
{
new
Swiper
(
'
.swiper-container
'
,
{
modules
:
[
Navigation
,
Pagination
,
Autoplay
],
...
...
@@ -31,12 +48,14 @@ onMounted(() => {
<div
class=
"center-width header-top"
>
<i
class=
"logo"
></i>
<ul
class=
"navigation"
>
<li
class=
"active"
>
首 页
</li>
<li>
产品技术
</li>
<li>
客户名录
</li>
<li>
新闻资讯
</li>
<li>
加入我们
</li>
<li>
关于我们
</li>
<li
v-for=
"item in navItems"
:key=
"item.path"
:class=
"
{ active: route.path === item.path }"
@click="handleNavClick(item.path)"
>
{{
item
.
name
}}
</li>
</ul>
<div
style=
"clear: both;"
></div>
</div>
...
...
@@ -65,4 +84,8 @@ onMounted(() => {
width
:
100%
;
overflow
:
hidden
;
}
.navigation
li
{
cursor
:
pointer
;
}
</
style
>
\ No newline at end of file
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