lesson 23: using the native event
This commit is contained in:
parent
c9f6b1af57
commit
467f1fddb1
|
@ -6,8 +6,8 @@ const app = Vue.createApp({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setName(event) {
|
setName(event, lastName) {
|
||||||
this.name = event.target.value;
|
this.name = event.target.value + " " + lastName;
|
||||||
},
|
},
|
||||||
increaseCounter(inputNumber) {
|
increaseCounter(inputNumber) {
|
||||||
this.counter = this.counter + inputNumber;
|
this.counter = this.counter + inputNumber;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<button v-on:click="increaseCounter(10)">Add 10</button>
|
<button v-on:click="increaseCounter(10)">Add 10</button>
|
||||||
<button v-on:click="decreaseCounter(5)">Reduce 5</button>
|
<button v-on:click="decreaseCounter(5)">Reduce 5</button>
|
||||||
<p>Result: {{ counter }}</p>
|
<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>
|
<p>Your Name: {{name}}</p>
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
|
|
Reference in New Issue
Block a user