
<template>
<div
style="font-family: Roboto-Bold, Roboto; font-weight: bold; color: #1977c4;text-align:right;width: 100%;"
>
<span>{{ timeInfo.ymd }}</span>
<span>{{ timeInfo.week }}</span>
<span>{{ timeInfo.time }}</span>
</div>
</template>
<script>
import { parseTime } from "@/utils";
export default {
components: {},
props: {},
data() {
return {
timeInfo: {
ymd: "",
week: "",
time: "",
},
};
},
computed: {},
watch: {},
created() {},
mounted() {
this.initTime();
},
methods: {
initTime() {
clearInterval(this.$el.initTimer);
let timer = setInterval(() => {
this.timeInfo.ymd = parseTime(new Date(), "{yy}-{mm}-{dd}");
this.timeInfo.week = parseTime(new Date(), "星期{a}");
this.timeInfo.time = parseTime(new Date(), "{hh}:{ii}:{ss}");
},1000);
this.$el.initTimer = timer;
},
},
};
</script>
<style scoped lang='scss'>
</style>
<timeInfo class="timeInfo"></timeInfo>
import timeInfo from "./components/timeInfo.vue";
components: { timeInfo },