I need to have a component that has a text input, but what the user types is modified before sending it up to the parent model…
const model = defineModel({
type: String,
});
const inputModel = ref('');
<input v-model="inputModel" />
So I declare model
using defineModel
so the parent can access it.
I also declare inputModel
so my inputs value is stored soemwhere.
But, how do I modify the inputModel
and assign it to model
?
For example, let’s pretend we want to use .toLowerCase()
:
const model = defineModel({
type: String,
});
const inputModel = ref('');
<input v-model="inputModel" /> //when this changes set model.toLowerCase() - how?
3