Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to bind the title attribute using Vue shorthand syntax.
Vue
<button [1]="buttonTitle">Click me</button>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '@title' which is for event listeners, not attribute binding.
Writing 'bind:title' which is not valid Vue syntax.
✗ Incorrect
In Vue, the shorthand for binding an attribute is a colon (:). So
:title binds the title attribute to the variable.2fill in blank
mediumComplete the code to listen for a click event using Vue shorthand syntax.
Vue
<button [1]="handleClick">Submit</button>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':click' which is for binding, not event listening.
Writing 'on:click' which is not valid Vue syntax.
✗ Incorrect
Vue uses '@' as a shorthand for v-on to listen to events. So
@click listens for the click event.3fill in blank
hardFix the error in the code by using the correct shorthand syntax for binding the src attribute.
Vue
<img [1]="imageUrl" alt="Image">
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '@src' which is invalid for attribute binding.
Leaving 'src' without binding, which won't update dynamically.
✗ Incorrect
To bind the
src attribute dynamically, Vue uses :src shorthand for v-bind:src.4fill in blank
hardFill both blanks to bind the href attribute and listen for a mouseover event using Vue shorthand syntax.
Vue
<a [1]="linkUrl" [2]="onHover">Hover here</a>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '@href' which is invalid for attribute binding.
Using ':mouseover' which is invalid for event listening.
✗ Incorrect
Use
:href to bind the href attribute and @mouseover to listen for the mouseover event.5fill in blank
hardFill all three blanks to bind the value attribute, listen for an input event, and bind the disabled attribute using Vue shorthand syntax.
Vue
<input [1]="inputValue" [2]="onInput" [3]="isDisabled">
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '@value' which is invalid for attribute binding.
Using ':input' which is invalid for event listening.
✗ Incorrect
Use
:value to bind the value attribute, @input to listen for input events, and :disabled to bind the disabled attribute.