lesson 24: add keyup event
This commit is contained in:
parent
e1524b4661
commit
953fd0fb9e
|
@ -3,9 +3,13 @@ const app = Vue.createApp({
|
|||
return {
|
||||
counter: 0,
|
||||
name: "",
|
||||
confirmedName: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
confirmName() {
|
||||
this.confirmedName = this.name;
|
||||
},
|
||||
submitForm() {
|
||||
alert("Submitted");
|
||||
},
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
<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($event, 'SomeOtherINput')">
|
||||
<p>Your Name: {{name}}</p>
|
||||
<input type="text" v-on:input="setName($event, 'SomeOtherINput')" v-on:keyup.enter="confirmName" />
|
||||
<p>Your Name: {{ confirmedName }}</p>
|
||||
<form v-on:submit.prevent="submitForm"><input type="text"><button>Sign Up</button></form>
|
||||
</section>
|
||||
</body>
|
||||
|
|
Reference in New Issue