lesson 23: using the native event
This commit is contained in:
parent
c9f6b1af57
commit
467f1fddb1
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
Reference in New Issue