I have three components and I want to pass a reactive model down from parent -> child -> grandchild (vee-validate field).
So the parent component looks like:
<template> <child v-model="formData" /> </template> . . . setup() { const formData = ref<CreateAccount>({ email: "", firstName: "", lastName: "" }); return { formData, }; }
Child components (with grandchildren) look like:
<template> <Field type="text" name="email" v-model="modelValue.email" ???? /> </template> export default defineComponent({ name: "step-2", components: { Field, }, props: { modelValue: { type: Object, required: true, }, }, emits: ["update:modelValue"], }, });
Now my problem is that I can't just pass the modelValue to the Field v-model property, so I'm not sure if there is a series of events or...
I ended up using the following solution in my child component: