Skip to content

Commit

Permalink
feat:#1 新增头部日历
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Oct 9, 2022
1 parent 16a4228 commit 6034cdc
Show file tree
Hide file tree
Showing 7 changed files with 1,223 additions and 9 deletions.
5 changes: 4 additions & 1 deletion components/default/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
</template>
</el-page-header>

<Navbar/>
<header-time/>

<navbar/>
</header>
</template>

<script lang="ts" setup>
import Navbar from "~/components/default/Navbar.vue";
import {ElPageHeader} from "element-plus";
import {ArrowLeft} from '@element-plus/icons-vue'
import HeaderTime from "~/components/default/HeaderTime.vue";
const router = useRouter();
const onBack = () => {
Expand Down
70 changes: 70 additions & 0 deletions components/default/HeaderTime.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<template>
<el-row class="time">
<el-col :xs="24" :sm="24" :md="8">
<div>
现在是
<client-only>
{{ timeData.clientTime }}
</client-only>
{{ timeData.weekday }}
</div>
</el-col>
<el-col :xs="24" :sm="24" :md="8">
<div>{{ timeData.popTime === "" ? "加载中..." : timeData.popTime }}</div>
</el-col>
<el-col :xs="24" :sm="24" :md="8">
<div>{{ timeData.tradTime === "" ? "加载中..." : timeData.tradTime }}</div>
</el-col>
</el-row>
</template>

<script lang="ts" setup>
import {ElCol, ElRow} from "element-plus";
import {
getClientTime, getWeekByDay,
getPopTime,
getShengXiao,
getTradTime
} from "~/lib/DateUtil";
import {onMounted} from "vue";
import {inBrowser} from "~/lib/util";
const timeData = ref({
clientTime: "",
weekday: "",
popTime: "",
tradTime: "",
shengxiao: ""
})
const initData = () => {
timeData.value.clientTime = getClientTime()
timeData.value.weekday = getWeekByDay();
timeData.value.popTime = getPopTime();
timeData.value.tradTime = getTradTime();
timeData.value.shengxiao = getShengXiao();
}
initData();
onMounted(() => {
if (inBrowser()) {
setInterval(function () {
timeData.value.clientTime = getClientTime();
}, 1000);
}
})
</script>

<script lang="ts">
export default {
name: "HeaderTime"
}
</script>

<style scoped lang="scss">
.time {
line-height: 30px;
text-align: left;
padding: 10px;
}
</style>
4 changes: 1 addition & 3 deletions components/default/HomePostList.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<template>
<div>
Data begin
{{ data }}
Data end
{{ data.msg }}

<h1>
<NuxtLink to="/post">
Expand Down
7 changes: 2 additions & 5 deletions components/default/Navbar.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<template>
<Examples/>
<div>navbar</div>
</template>

<script lang="ts" setup>
import Examples from "~/components/Examples.vue";
</script>
<script lang="ts" setup></script>

<script lang="ts">
Expand Down
Loading

0 comments on commit 6034cdc

Please sign in to comment.