add a method to add a lastName
This commit is contained in:
parent
595a7183be
commit
f7f506471f
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Reference in New Issue