Vue3 Custom Checkbox not updating value #3431
-
Hi, I created an custom checkbox component under Field element. I followed the documentation https://vee-validate.logaretm.com/v4/examples/checkboxes-and-radio in here but i couldnt produced the expected result. I attempt many different approaches to fix it but I dont know any other way about it. I also made another Custom Components under Field and there were no problem when using them. Only problem appears on checkbox. Custom checkbox can get the correct initial state but clicking on checkbox not actually changing the value I created an sandbox to show that issue ( It is minified version of my component to reproduce that problem easily ) https://codesandbox.io/s/vue3veevalidatecustomcheckbox-dn7c2 Any helps? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You didn't bind the Here is some changes that make it work as expected: |
Beta Was this translation helpful? Give feedback.
You didn't bind the
Field
withv-model
to change yourx
value. Also inside your checkbox, you didn't handle any events from the native input.Here is some changes that make it work as expected:
https://codesandbox.io/s/vue3veevalidatecustomcheckbox-forked-dijtv?file=/src/components/HelloWorld.vue