lesson 23: using the native event

This commit is contained in:
Andreas Zweili 2021-01-18 18:09:41 +01:00
parent c9f6b1af57
commit 467f1fddb1
2 changed files with 3 additions and 3 deletions

View File

@ -6,8 +6,8 @@ const app = Vue.createApp({
};
},
methods: {
setName(event) {
this.name = event.target.value;
setName(event, lastName) {
this.name = event.target.value + " " + lastName;
},
increaseCounter(inputNumber) {
this.counter = this.counter + inputNumber;

View File

@ -20,7 +20,7 @@
<button v-on:click="increaseCounter(10)">Add 10</button>
<button v-on:click="decreaseCounter(5)">Reduce 5</button>
<p>Result: {{ counter }}</p>
<input type="text" v-on:input="setName">
<input type="text" v-on:input="setName($event, 'SomeOtherINput')">
<p>Your Name: {{name}}</p>
</section>
</body>