dl_site_nuxt/components/header.vue
2025-07-06 18:38:53 +08:00

173 lines
3.9 KiB
Vue

<template>
<div>
<header class="header-box d-none d-md-flex justify-content-between align-items-center">
<img src="~assets/image/logo.png" width="265px" :alt="$t('index.corporateName')">
<nav class="d-md-flex align-items-center">
<nuxt-link
class="nav-link-item d-flex align-items-center"
:to="item.href"
v-for="(item,index) in menuList"
:key="index"
>
{{ item.name }}
</nuxt-link>
</nav>
<div class="search-box">
<img class="search-icon" src="~assets/image/icon/search.png" alt="search" />
<b-form-input
class="search-input"
v-model="searchVal"
placeholder="SEARCH"
>
</b-form-input>
</div>
</header>
<header class="header-box-mob d-block d-md-none">
<div class="header-top">
<img class="mr-4" src="~assets/image/mob-logo.png" width="164px" :alt="$t('index.corporateName')">
<div class="search-box">
<img class="search-icon" src="~assets/image/icon/search.png" :alt="$t('common.search')" />
<b-form-input
class="search-input"
v-model="searchVal"
placeholder="SEARCH"
>
</b-form-input>
<img
class="ml-2"
src="~assets/image/icon/menu.png"
:alt="$t('common.menu')"
@click="$refs.menuDrawerRef.drawer=true"
/>
</div>
</div>
<nav class="mob-nav hide_scroll_bar d-flex align-items-center">
<nuxt-link
class="nav-link-item d-flex align-items-center"
:to="item.href"
v-for="(item,index) in menuList"
:key="index"
>
{{ item.name }}
</nuxt-link>
</nav>
</header>
<MenuDrawer ref="menuDrawerRef" />
</div>
</template>
<script>
import MenuDrawer from './menu-drawer.vue';
export default {
components: { MenuDrawer },
data() {
return {
searchVal: '',
menuList: [
{ name: this.$t('menu.Home'), href: '/' },
{ name: this.$t('menu.AboutUs'), href: '/abou-us' },
{ name: this.$t('menu.Products'), href: '/products' },
{ name: this.$t('menu.News'), href: '/news' },
{ name: this.$t('menu.Exhibition'), href: '/exhibition' },
{ name: this.$t('menu.ContactUs'), href: '/contact-us' },
{ name: this.$t('menu.Feedback'), href: '/feedback' },
]
}
},
}
</script>
<style lang="scss" scoped>
.search-box {
position: relative;
display: flex;
align-items: center;
.search-icon {
width: 1rem;
height: 1rem;
position: absolute;
top: 50%;
left: 1rem;
transform: translateY(-50%);
}
.search-input {
width: 7.5rem;
height: 2.75rem;
padding-left: 2.5rem;
border-color: #015fe8;
border-radius: 1.375rem;
transition: all 0.5s ease-in-out;
&:focus {
width: 21.25rem;
}
&::placeholder {
color: #015fe8;
}
}
}
@mixin activeNav {
&:hover {
position: relative;
color: #015fe8;
background: linear-gradient( 180deg, rgba(1,95,232,0) 0%, rgba(1,95,232,0.08) 100%);
&::before {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: .125rem;
background: #015fe8;
}
>a {
color: #015fe8;
}
}
}
nav {
height: 100%;
.nav-link-item {
height: 100%;
padding: 0 1.4375rem;
>a {
color: #151516;
}
@include activeNav;
}
.active-item {
@include activeNav;
}
}
.header-box {
width: 100%;
height: 5.75rem;
padding: 0 1.9375rem;
}
.header-box-mob {
width: 100%;
.header-top {
padding: .8125rem;
display: flex;
align-items: center;
justify-content: space-between;
.search-box {
flex: 1;
.search-input {
width: 100%;
height: 2.1875rem;
}
}
}
.mob-nav {
height: 2.5rem;
overflow-y: auto;
}
}
</style>