diff --git a/basics-05-using-the-native-event-object/app.js b/basics-05-using-the-native-event-object/app.js index e47cc51..d913d87 100644 --- a/basics-05-using-the-native-event-object/app.js +++ b/basics-05-using-the-native-event-object/app.js @@ -3,15 +3,33 @@ const app = Vue.createApp({ return { counter: 0, name: "", + lastName: "", + fullName: "", }; }, - computed: { - fullName() { - if (this.name === "") { - return ""; + watch: { + name(value) { + if (value === "") { + this.fullName = ""; + } else { + this.fullName = value + " " + this.lastName; } - return this.name + " " + "Muster"; }, + lastName(value) { + if (value === "") { + this.fullName = ""; + } else { + this.fullName = this.name + " " + value; + } + }, + }, + computed: { + // fullName() { + // if (this.name === "") { + // return ""; + // } + // return this.name + " " + "Muster"; + // }, }, methods: { setName(event) { diff --git a/basics-05-using-the-native-event-object/index.html b/basics-05-using-the-native-event-object/index.html index 625f97d..4317e63 100644 --- a/basics-05-using-the-native-event-object/index.html +++ b/basics-05-using-the-native-event-object/index.html @@ -21,6 +21,7 @@

Result: {{ counter }}

+

Your Name: {{ fullName }}