TS class components

This commit is contained in:
Jörn-Michael Miehe 2022-09-09 23:14:03 +00:00
parent d5171ee531
commit 18bb455ec9
2 changed files with 16 additions and 23 deletions

View file

@ -3,30 +3,24 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop, Vue } from "vue-property-decorator";
import moment from "moment";
export default Vue.extend({
name: "ClockDisplay",
@Component
export default class ClockDisplay extends Vue {
private clock = "";
data: () => ({
clock: "",
}),
@Prop()
format!: string;
props: {
format: String,
},
private update(): void {
this.clock = moment().format(this.format);
}
methods: {
update(): void {
this.clock = moment().format(this.format);
},
},
created(): void {
private created(): void {
setInterval(this.update, 1000);
},
});
}
}
</script>
<style>

View file

@ -10,16 +10,15 @@
</template>
<script>
import Vue from "vue";
import { Component, Vue } from "vue-property-decorator";
import ClockDisplay from "./ClockDisplay.vue";
export default Vue.extend({
name: "TitleBar",
@Component({
components: {
ClockDisplay,
},
});
})
export default class TitleBar extends Vue {}
</script>
<style>