0
0
Vueframework~10 mins

v-on directive for events in Vue - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to listen for a click event on the button.

Vue
<button [1]="handleClick">Click me</button>
Drag options to blanks, or click blank then click option'
Av-model:click
Bv-bind:click
Cv-on:click
Dv-if:click
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-bind instead of v-on for events.
Trying to use v-model for click events.
2fill in blank
medium

Complete the code to use the shorthand for the click event listener.

Vue
<button [1]="submitForm">Submit</button>
Drag options to blanks, or click blank then click option'
A*click
B#click
C:click
D@click
Attempts:
3 left
💡 Hint
Common Mistakes
Using : which is for binding, not events.
Using symbols like # or * which are invalid.
3fill in blank
hard

Fix the error in the event listener syntax to correctly listen for a mouseover event.

Vue
<div [1]="showTooltip">Hover me</div>
Drag options to blanks, or click blank then click option'
Av-on:mouseover
Bv-on.mouseover
Cv-on/mouseover
Dv-on-mouseover
Attempts:
3 left
💡 Hint
Common Mistakes
Using dot notation instead of colon.
Using slashes or dashes instead of colon.
4fill in blank
hard

Fill both blanks to listen for a keyup event and call the method with the event object.

Vue
<input [1]="handleKeyup($event)" [2]="textInput" />
Drag options to blanks, or click blank then click option'
Av-on:keyup
Bv-bind:value
Cv-model
Dv-on:click
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-bind:value instead of v-model for two-way binding.
Using v-on:click instead of v-on:keyup.
5fill in blank
hard

Fill all three blanks to listen for a submit event, prevent default behavior, and call the submitForm method.

Vue
<form [1].prevent="submitForm" [2]="formData" [3]="formData">
Drag options to blanks, or click blank then click option'
Av-on:submit
Bv-model
Cv-bind:data
Dv-on:click
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-on:click instead of v-on:submit.
Forgetting the .prevent modifier.
Using v-bind:data incorrectly.