lesson 24: event modifiers the proper way
This commit is contained in:
parent
1bd8145e81
commit
e1524b4661
|
@ -6,8 +6,7 @@ const app = Vue.createApp({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitForm(event) {
|
submitForm() {
|
||||||
event.preventDefault();
|
|
||||||
alert("Submitted");
|
alert("Submitted");
|
||||||
},
|
},
|
||||||
setName(event, lastName) {
|
setName(event, lastName) {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<p>Result: {{ counter }}</p>
|
<p>Result: {{ counter }}</p>
|
||||||
<input type="text" v-on:input="setName($event, 'SomeOtherINput')">
|
<input type="text" v-on:input="setName($event, 'SomeOtherINput')">
|
||||||
<p>Your Name: {{name}}</p>
|
<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>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Reference in New Issue