C. The method name in the template and script do not match in case.
D. The button tag is not closed properly.
Solution
Step 1: Compare method name in template and script
The template calls submitForm but the method is named submitform (lowercase f), causing a mismatch.
Step 2: Understand Vue method matching
Vue is case-sensitive, so the method won't be found and the click won't work.
Final Answer:
The method name in the template and script do not match in case. -> Option C
Quick Check:
Method names must match exactly [OK]
Hint: Check method names match exactly (case sensitive) [OK]
Common Mistakes:
Ignoring case sensitivity in method names
Thinking parentheses are required in @click
Assuming console.log syntax is wrong
5. You want to update a message on the page when a user types in an input box. Which Vue setup correctly handles the input event to update the message reactively?
<template>
<input @input="updateMessage" />
<p>Message: {{ message }}</p>
</template>
<script setup>
import { ref } from 'vue'
const message = ref('')
function updateMessage(event) {
// What should go here?
}
</script>
hard
A. message.value = event.target.value
B. message = event.target.value
C. this.message = event.target.value
D. message.value = event.value
Solution
Step 1: Understand Vue ref and event object
message is a ref, so to update its value, use message.value. The event object has the input value in event.target.value.
Step 2: Choose correct assignment
Assigning message.value = event.target.value updates the reactive ref correctly.
Final Answer:
message.value = event.target.value -> Option A
Quick Check:
Update ref with message.value = event.target.value [OK]
Hint: Use message.value = event.target.value to update ref [OK]
Common Mistakes:
Assigning directly to message without .value
Using this.message in script setup (no this context)
Using event.value instead of event.target.value
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.