1<template>
2 <div>
3 <input type="text" name="Test Value" id="" v-model="text">
4
5 <label>{{label}}</label>
6 </div>
7
8</template>
9
10<script lang="ts">
11import { Component, Vue, Watch } from "vue-property-decorator";
12
13@Component({})
14export default class About extends Vue {
15 private text = "test";
16
17 get label() {
18 return this.text;
19 }
20}
21</script>
22
23
24// compotion-api style vue3 default
25
26<script lang="ts">
27import { defineComponent, ref, computed } from "@vue/composition-api";
28
29export default defineComponent({
30 setup() {
31 const text = ref("test");
32
33 const label = computed(() => {
34 return text.value;
35 });
36
37 return {
38 text,
39 label
40 };
41 }
42});
43</script>