lesson 24: event modifiers the obvious way

This commit is contained in:
Andreas Zweili 2021-01-18 18:15:02 +01:00
parent 467f1fddb1
commit 1bd8145e81
2 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,10 @@ const app = Vue.createApp({
};
},
methods: {
submitForm(event) {
event.preventDefault();
alert("Submitted");
},
setName(event, lastName) {
this.name = event.target.value + " " + lastName;
},

View File

@ -22,6 +22,7 @@
<p>Result: {{ counter }}</p>
<input type="text" v-on:input="setName($event, 'SomeOtherINput')">
<p>Your Name: {{name}}</p>
<form v-on:submit="submitForm"><input type="text"><button>Sign Up</button></form>
</section>
</body>