bemarket/src/components/main/MainHeader.vue
2022-01-04 19:36:00 +08:00

223 lines
5.5 KiB
Vue

<template>
<header class="header fixed">
<div class="menu-list">
<div class="logo_header"><img src="@/assets/main/p1/icon_logo_t.png"></div>
<div data-menuanchor="home" class="marked_icon">
<a href="/market"><img src="@/assets/main/p1/btn_market.png"></a>
</div>
<div class="menu-icon" @click="toggleDrop">
<img v-if="!dropShow" src="@/assets/main/p1/menu.png">
<img v-if="dropShow" src="@/assets/main/p1/close.png">
</div>
</div>
<div class="menu_fullpage" >
<ul>
<li data-menuanchor="home" @click="changeSection" :class="{'active': currentSection === 'home'}">
<a href="#home_section"><img src="@/assets/main/p1/btn_home.png"></a>
</li>
<li data-menuanchor="video" @click="changeSection" :class="{'active': currentSection === 'video'}" >
<a href="#video_section"><img src="@/assets/main/p1/btn_video.png"></a>
</li>
<li data-menuanchor="gameplay" @click="changeSection" :class="{'active': currentSection === 'gameplay'}">
<a href="#gameplay_section"><img src="@/assets/main/p1/btn_gameplay.png"></a>
</li>
<li data-menuanchor="nft" @click="changeSection" :class="{'active': currentSection === 'nft'}">
<a href="#nft_section"><img src="@/assets/main/p1/btn_nft.png"></a>
</li>
<li data-menuanchor="chip" @click="changeSection" :class="{'active': currentSection === 'chip'}">
<a href="#chip_section"><img src="@/assets/main/p1/btn_chip.png"></a>
</li>
</ul>
</div>
<div class="menu_drop" v-if="dropShow">
<ul>
<li data-menuanchor="home" @click="changeSection" :class="{'active': currentSection === 'home'}">
<a href="#home_section">HOME</a>
</li>
<li data-menuanchor="video" @click="changeSection" :class="{'active': currentSection === 'video'}" >
<a href="#video_section">VIDEO</a>
</li>
<li data-menuanchor="gameplay" @click="changeSection" :class="{'active': currentSection === 'gameplay'}">
<a href="#gameplay_section">GAMEPLAY</a>
</li>
<li data-menuanchor="nft" @click="changeSection" :class="{'active': currentSection === 'nft'}">
<a href="#nft_section">NFT ITEM</a>
</li>
<li data-menuanchor="chip" @click="changeSection" :class="{'active': currentSection === 'chip'}">
<a href="#chip_section">CHIP</a>
</li>
</ul>
</div>
</header>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
declare module 'vue/types/vue' {
interface Vue {
currentSection?: string
}
}
@Component({
name: 'MainHeader',
components: {
},
props: ['currentSection']
})
export default class extends Vue {
private dropShow = false
changeSection(e: PointerEvent) {
this.dropShow = false
const target = e.currentTarget as HTMLElement
if (target) {
this.$emit('section-change', target.dataset.menuanchor)
}
}
toggleDrop() {
this.dropShow = !this.dropShow
}
}
</script>
<style lang="scss" scoped>
.header{
top: 0;
left: 0;
right: 0;
z-index: 99;
max-width: 1920px;
margin: 0 auto;
background-image: url('~@/assets/main/p1/bg_header.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.fixed.header {
position: fixed;
display: flex;
}
.menu-list {
width: 100vw;
display: flex;
align-items: center;
justify-content: space-between;
}
.logo_header{
width: 100px;
height: 80px;
margin-left: 8px;
}
.logo_header img{
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
.menu_fullpage{
width: 50vw;
position: absolute;
top: 0;
right: 280px;
display: flex;
-webkit-box-align: center;
justify-content: flex-end;
-webkit-box-pack: end;
align-items: center;
padding-bottom: 3px;
}
.menu_fullpage ul{
display: flex;
-webkit-box-align: center;
lign-items: center;
list-style: none;
padding-left: 0;
margin-top: 8px;
margin-bottom: 8px;
}
.menu_fullpage ul li {
padding: 28px 10px 0;
display: list-item;
text-align: -webkit-match-parent;
margin-left: 30px;
}
.menu_fullpage ul .active{
background-image: url('~@/assets/main/p1/btn_bg.png');
background-repeat: repeat-x;
background-position: 0 17px;
}
.marked_icon {
margin-top: 8px;
}
.menu-icon {
display: none;
}
@media (max-width: 767px) {
.header {
font-size: 11px;
display: block;
}
.logo_header{
width: 50px;
height: 40px;
}
.menu_fullpage{
display: none;
}
.menu_drop {
display: flex;
position: absolute;
top: 50px;
right: 0;
width: 50vw;
background-image: url('~@/assets/main/p1/bg_header.png');
background-repeat: no-repeat;
background-size: 100% 100%;
justify-content: flex-start;
padding-bottom: 20px;
}
.menu_drop ul .active{
background-image: none;
}
.menu_drop ul {
flex-direction: column;
display: flex;
-webkit-box-align: center;
lign-items: center;
list-style: none;
padding-left: 0;
margin-top: 8px;
margin-bottom: 8px;
}
.menu_drop ul li {
padding: 28px 10px 0;
display: list-item;
text-align: -webkit-match-parent;
margin-left: 30px;
color: white;
}
.menu_drop ul li a {
color: white;
text-decoration: none;
font-size: 3vw;
}
.marked_icon{
margin-bottom: 8px;
width: 80vw;
}
.marked_icon img {
width: 160px;
float: right;
}
.menu-icon{
display: inherit;
width: 32px;
height: 32px;
}
}
</style>