add a method to add a lastName

This commit is contained in:
Andreas Zweili 2021-01-18 21:02:10 +01:00
parent 595a7183be
commit f7f506471f
2 changed files with 7 additions and 1 deletions

View File

@ -6,6 +6,12 @@ const app = Vue.createApp({
};
},
methods: {
outputFullName() {
if (this.name === "") {
return "";
}
return this.name + " " + "Muster";
},
setName(event) {
this.name = event.target.value;
},

View File

@ -22,7 +22,7 @@
<p>Result: {{ counter }}</p>
<input type="text" v-model="name">
<button v-on:click="resetInput">Reset Input</button>
<p>Your Name: {{ name }}</p>
<p>Your Name: {{ outputFullName() }}</p>
</section>
</body>