Vue · Middle · Question 11 of 75
What do defineModel modifiers let you do?
const [model, modifiers] = defineModel({
set(value) { return modifiers.capitalize ? value.charAt(0).toUpperCase() + value.slice(1) : value; },
});
// parent: <MyInput v-model.capitalize="text" />- ✓Correct answer: Read custom
v-modelmodifiers and transform the value before it is emitted - 2Validate the value and throw on error
- 3Bind the model to several parents
Explanation
Destructuring defineModel gives the ref and the modifiers object. get/set options transform values in both directions.