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: {
|
methods: {
|
||||||
|
outputFullName() {
|
||||||
|
if (this.name === "") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return this.name + " " + "Muster";
|
||||||
|
},
|
||||||
setName(event) {
|
setName(event) {
|
||||||
this.name = event.target.value;
|
this.name = event.target.value;
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<p>Result: {{ counter }}</p>
|
<p>Result: {{ counter }}</p>
|
||||||
<input type="text" v-model="name">
|
<input type="text" v-model="name">
|
||||||
<button v-on:click="resetInput">Reset Input</button>
|
<button v-on:click="resetInput">Reset Input</button>
|
||||||
<p>Your Name: {{ name }}</p>
|
<p>Your Name: {{ outputFullName() }}</p>
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Reference in New Issue