renames
This commit is contained in:
parent
cd2cf8ca08
commit
0a19286261
2 changed files with 11 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div>{{ clock }}</div>
|
<div>{{ formatted }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -7,23 +7,22 @@ import { Component, Prop, Vue } from "vue-property-decorator";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default class ClockDisplay extends Vue {
|
export default class Clock extends Vue {
|
||||||
private clock = "";
|
private formatted = "";
|
||||||
private interval?: number;
|
private interval?: number;
|
||||||
|
|
||||||
@Prop()
|
@Prop()
|
||||||
format!: string;
|
public format!: string;
|
||||||
|
|
||||||
private created(): void {
|
public created(): void {
|
||||||
this.interval = setInterval((): void => {
|
this.interval = setInterval((): void => {
|
||||||
this.clock = DateTime.now()
|
this.formatted = DateTime.now()
|
||||||
.setLocale(navigator.language)
|
.setLocale(navigator.language)
|
||||||
.toFormat(this.format);
|
.toFormat(this.format);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private beforeDestroy(): void {
|
public beforeDestroy(): void {
|
||||||
// prevent memory leak
|
|
||||||
clearInterval(this.interval);
|
clearInterval(this.interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,19 +3,19 @@
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
|
|
||||||
<v-col>
|
<v-col>
|
||||||
<ClockDisplay format="DDD" />
|
<Clock format="DDD" />
|
||||||
<ClockDisplay format="T" />
|
<Clock format="T" />
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-toolbar>
|
</v-toolbar>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
import ClockDisplay from "./ClockDisplay.vue";
|
import Clock from "./Clock.vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
ClockDisplay,
|
Clock,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class TitleBar extends Vue {}
|
export default class TitleBar extends Vue {}
|
||||||
|
|
Loading…
Reference in a new issue