[feature request] be able to set onUpdate:modelValue handler with v-model directive
Hello,
What problem does this feature solve?
i would like to find a solution to shorten this syntax :
:modelValue="value" @update:modelValue="handleChange"
i use it everywhere and it's quite long and verbose for what it does,
i would like to be able to set onUpdate:modelValue
handler within the v-model
directive somehow
What does the proposed API look like?
i would do something like v-model.update="{ value, handleChange }"
, but i don't really know
thanks !
You can use v-model="value"
and give value
a computed setter. See Writable Computed.
Well i don't think i will have access to handleChange from a computed property, it comes from vee-validate v-slots
Maybe vee-validate could expose a composable version of the slot-one you are using so you can do:
const modelValue = computed({
get: () => val.value, // or props.value, depends where it comes from
set: handleChange,
})
Remember to use the forum or the Discord chat to ask questions!