doc: update TheHeader component

This commit is contained in:
Leon Xu committed 2022-02-22 14:14:40 -08:00
1 parent 30063f65d4
commit a76f8f416c
1 file changed
+81 -3
+81 -3
View File
@@ -1,12 +1,90 @@
<template>
<section></section>
<section>
<header v-if="addCityActive" class="container add-city">
<nav>
<span>添加城市</span>
<div class="right">
<i @click="editCities" ref="editCities" class="far fa-edit"></i>
<i @click="reloadApp" class="fas fa-sync"></i>
<i @click="addCity" class="fas fa-plus"></i>
</div>
</nav>
</header>
<header v-else class="container" :class="{ day: isDay, night: isNight }">
<nav>
<router-link class="router-link" :to="{ name: 'AddCity' }">
<i class="fas fa-home"></i>
</router-link>
<span
>{{ new Date().toLocaleString("zh-CN", { weekday: "short" }) }},
{{ new Date().toLocaleString("zh-CN", { month: "short" }) }}
{{ new Date().toLocaleString("zh-CN", { day: "2-digit" }) }}</span
>
<span>&deg; C</span>
</nav>
</header>
</section>
</template>
<script>
export default {
name: "TheHeader",
props: ["addCityActive", "isDay", "isNight"],
methods: {
addCity() {
this.$emit("add-city");
},
reloadApp() {
location.reload();
},
editCities() {
this.$refs.editCities.classList.toggle("edit-active");
this.$emit("edit-city");
},
},
};
</script>
<style>
</style>
<style lang="scss" scoped>
.add-city {
background-color: #313640;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
header {
z-index: 99;
position: fixed;
max-width: 1024px;
width: 100%;
nav {
display: flex;
color: #fff;
padding: 30px 0;
justify-content: space-between;
}
.edit-active {
color: rgba(210, 75, 75, 1);
}
.router-link {
color: #fff;
}
.right {
i {
font-size: 20px;
}
i:nth-child(2),
i:nth-child(3) {
margin-left: 16px;
}
}
span {
font-weight: 600;
}
}
</style>