Radio with slot not updating v-model #3805
-
Hi, When I try to use standard radio inputs with a v-model, it seems that the v-model doesn't get updated and its default value seems doesn't get applied. I want to use a custom implementation with slot like below, not with a v-field component. I tried it with handleChange and @change event but couldn't make it work. Am I missing something? I am using vee-validate 4.5.11 with yup schema and all other input's are woking very well. Thank you <Field
name="standardRadioModel"
type="radio"
v-slot="{ field, errors, handleChange, meta }"
:value="null"
>
<div>
<input
type="radio"
name="standardRadioModel"
value="HTML"
id="html"
v-bind="field"
/>
<label for="html">
HTML
</label>
</div>
<div>
<input
type="radio"
name="standardRadioModel"
value="CSS"
id="css"
v-bind="field"
/>
<label for="css"> CSS </label>
</div>
</Field> VersionVue.js 3.x and vee-validate 4.x What browsers are you seeing the problem on?
Demo linkhttps://codesandbox.io/s/custom-text-input-with-vee-validate-v4-forked-c93iz0?file=/src/App.vue Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Have you tried using <Field
name="standardRadioModel"
type="radio"
v-model="standardRadioModel"
v-slot="{ field, errors, meta }"
>
....
</Field> I've updated the example here: P.S: I moved this to discussions since I do not think this is a bug or an issue. |
Beta Was this translation helpful? Give feedback.
-
Yes, It worked like a charm! Thank you! |
Beta Was this translation helpful? Give feedback.
Have you tried using
v-model
on theField
component itself?I've updated the example here:
https://codesandbox.io/s/custom-text-input-with-vee-validate-v4-forked-3p9rfs?file=/src/App.vue:138-291
P.S: I moved this to discussions since I do not think this is a bug or an issue.