lesson 24: event modifiers the proper way

This commit is contained in:
Andreas Zweili 2021-01-18 18:17:06 +01:00
parent 1bd8145e81
commit e1524b4661
2 changed files with 2 additions and 3 deletions

View File

@ -6,8 +6,7 @@ const app = Vue.createApp({
};
},
methods: {
submitForm(event) {
event.preventDefault();
submitForm() {
alert("Submitted");
},
setName(event, lastName) {

View File

@ -22,7 +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>
<form v-on:submit.prevent="submitForm"><input type="text"><button>Sign Up</button></form>
</section>
</body>