[Update] add active style on header in home

This commit is contained in:
barrystone 2021-03-28 11:07:03 +08:00
parent 62dc750910
commit 05cc585797
3 changed files with 69 additions and 9 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div id="app"> <div id="app">
<Header v-if="headerVisible()" /> <Header v-if="headerVisible()" v-bind:route="$route" />
<router-view /> <router-view />
<Footer /> <Footer />
</div> </div>

View File

@ -34,7 +34,7 @@
width: 80%; width: 80%;
} }
&-link { &-links {
float: right; float: right;
width: 600px; width: 600px;
margin-right: 92px; margin-right: 92px;
@ -56,6 +56,9 @@
height: 100%; height: 100%;
display: block; display: block;
text-align: left; text-align: left;
// &:active {
// border-bottom: $indigo-blue solid 5px;
// }
a { a {
font-size: 12pt; font-size: 12pt;
@ -66,6 +69,11 @@
} }
} }
&-link--active {
// padding-bottom: 10px;
border-bottom: $indigo-blue solid 3.5px;
}
&-apply { &-apply {
width: 92px; width: 92px;
height: 38px; height: 38px;

View File

@ -13,13 +13,49 @@
</div> </div>
</div> </div>
<div class="header__right"> <div class="header__right">
<div class="header-link"> <div class="header-links">
<ul> <ul>
<li><a href="/2021/agenda">議程與活動</a></li> <li>
<li><a href="/2021/traffic">交通方式</a></li> <input
<li><a href="/2021/venue">會場地圖</a></li> type="radio"
<li><a href="/2021/sponsor">贊助資訊</a></li> id="1"
<li><a href="/2021/team">籌備團隊</a></li> class="header-link__input"
name="checlbox"
/>
<a
href="/2021/agenda"
v-bind:class="onRoute('Agenda') ? 'header-link--active' : ''"
>議程與活動</a
>
</li>
<li>
<a
href="/2021/traffic"
v-bind:class="onRoute('Traffic') ? 'header-link--active' : ''"
>交通方式</a
>
</li>
<li>
<a
href="/2021/venue"
v-bind:class="onRoute('Venue') ? 'header-link--active' : ''"
>會場地圖</a
>
</li>
<li>
<a
href="/2021/sponsor"
v-bind:class="onRoute('Sponsor') ? 'header-link--active' : ''"
>贊助資訊</a
>
</li>
<li>
<a
href="/2021/team"
v-bind:class="onRoute('Team') ? 'header-link--active' : ''"
>籌備團隊</a
>
</li>
</ul> </ul>
</div> </div>
<div class="header-apply"> <div class="header-apply">
@ -34,8 +70,24 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from "vue-property-decorator";
@Component @Component({
props: ["route"],
})
export default class Header extends Vue { export default class Header extends Vue {
mounted() {
console.log(this.$props.route.name);
}
public onRoute(routeName: String) {
return this.$props.route.name === routeName ? true : false;
}
// computed(){
// pagePosition:function(){
// }
// }
// header = document.getElementById("topHeader"); // header = document.getElementById("topHeader");
// sticky = this.header.offsetTop; // sticky = this.header.offsetTop;
// header = null; // header = null;