-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]: v-model not updating input value in Shadcn-vue Input component inside a Form #771
Comments
It seems to work if I bind the |
Don't create new Instead use https://stackblitz.com/edit/1d3tzs-8cmpb1?file=src%2FApp.vue |
Oooh ok cool ! So I can access to the values via
And it works! Thanks a lot ! Another questionHow can I pass the values to child component, it's like a Because in my context I have a stepper (with two steps) inside the form and each steps is a component. It's a form application with fields into the steps. |
In Stepper it's better to use https://www.shadcn-vue.com/docs/components/stepper.html#form So you could access the |
I am sorry but I can't understand how to do this... This is my
How can I use I want to modify / access (like I can't pass with this :
|
Can you share a minimal demo of your Stepper component I can't help in this way |
Sure ! There is a stackblitz of a minimal demo of my project. I'm currently using
I saw in the Vee Validate documentation that we can use |
Inside Outside
Even though the vee-validate docs says you can use |
Thanks for the solution ! But...I tried with
In my child component I have a
The only issue I have left is that I can't modify the value directly from the code like this :
I tried with directly changing the variable and tried with No one works... But I have this vue-warn : Do you know why ? I have to contact directly Sorry for the deep discussion : / Thanks a lot ! |
You need to use uniteLocale.value.setFieldValue('idle or object.idle', 'new value')
//or
uniteLocale.value.setValues({
idle: 'new value',
// or
'object.idle': 'new value'
}) |
It works fine ! Thanks a lot for all your help ! |
can somebody explain whats the point of adding these extra step instead of binding a ref to the input field? what benefit is there to not being able to bind to the input field? |
VeeValidate FormField slotProps already have model-value and @update:model-value (componentField slotProp), which is why it's better to use initialValues with componentField slotProp so we could also get a better resetForm functionality and get right types |
Reproduction
https://stackblitz.com/edit/1d3tzs-zd6u8m?file=src%2FApp.vue
Describe the bug
Description:
I am experiencing an issue with the
v-model
binding not updating the input value in theInput
component from Shadcn-vue inside aForm
. Even though the value changes in the parent component, the input field in the child component doesn't reflect the updated value.Steps to reproduce:
Input.vue
):Expected behavior:
The input field should update its value when
uniteLocale.ide
is modified programmatically.Actual behavior:
The value in the input field does not update even though the value of
uniteLocale.ide
changes.What I’ve tried:
passive: true
option fromuseVModel
.uniteLocale.ide
is being updated correctly by logging it and displaying it in a<span>
.watch
to observe changes tomodelValue
and emitupdate:modelValue
accordingly.Despite these changes, the input field does not reflect the updated value.
Additional context:
useVModel
from@vueuse/core
appears to work in other components, but here it doesn't update the input value as expected. Thespan
displayinguniteLocale.ide
is updated correctly, but not the input field.Thanks !
System Info
Contributes
The text was updated successfully, but these errors were encountered: