2021-02-15 10:17:19 +02:00
|
|
|
<template>
|
2021-02-21 06:34:00 +02:00
|
|
|
<div class="acemodlh _monospace">
|
|
|
|
<div>
|
|
|
|
<span v-text="y"></span>/<span v-text="m"></span>/<span v-text="d"></span>
|
|
|
|
</div>
|
|
|
|
<div>
|
2021-02-15 10:17:19 +02:00
|
|
|
<span v-text="hh"></span>
|
|
|
|
<span :style="{ visibility: showColon ? 'visible' : 'hidden' }">:</span>
|
|
|
|
<span v-text="mm"></span>
|
|
|
|
<span :style="{ visibility: showColon ? 'visible' : 'hidden' }">:</span>
|
|
|
|
<span v-text="ss"></span>
|
2021-02-21 06:34:00 +02:00
|
|
|
</div>
|
2021-02-15 10:17:19 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
clock: null,
|
2021-02-21 06:34:00 +02:00
|
|
|
y: null,
|
|
|
|
m: null,
|
|
|
|
d: null,
|
2021-02-15 10:17:19 +02:00
|
|
|
hh: null,
|
|
|
|
mm: null,
|
|
|
|
ss: null,
|
|
|
|
showColon: true,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.tick();
|
|
|
|
this.clock = setInterval(this.tick, 1000);
|
|
|
|
},
|
|
|
|
beforeUnmount() {
|
|
|
|
clearInterval(this.clock);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
tick() {
|
|
|
|
const now = new Date();
|
2021-02-21 06:34:00 +02:00
|
|
|
this.y = now.getFullYear().toString();
|
|
|
|
this.m = (now.getMonth() + 1).toString().padStart(2, '0');
|
|
|
|
this.d = now.getDate().toString().padStart(2, '0');
|
2021-02-15 10:17:19 +02:00
|
|
|
this.hh = now.getHours().toString().padStart(2, '0');
|
|
|
|
this.mm = now.getMinutes().toString().padStart(2, '0');
|
|
|
|
this.ss = now.getSeconds().toString().padStart(2, '0');
|
|
|
|
this.showColon = now.getSeconds() % 2 === 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2021-02-21 06:34:00 +02:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.acemodlh {
|
|
|
|
opacity: 0.7;
|
|
|
|
font-size: 0.85em;
|
|
|
|
line-height: 1em;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
</style>
|