I am working on a Vue JS project where I am creating a custom component to display multiple checkboxes on the page. The challenge I am facing is sending back the value to the component in order to attach a v-model
to it.
Currently, all my checkboxes allow me to select either true or false, but my goal is to send back only one true value. For example, if I choose 2 out of 4 checkboxes, the v-model
on my component should have the value of true.
I have successfully rendered the checkboxes, however, I am struggling to make the v-model
function as intended. Can someone point out what I might be doing wrong?
<GroupedCheckboxes :options="editor.sources" v-model="source.isChecked" />
Here is the code for my custom component:
<template>
<div>
<div v-for="(checkbox, index) in options" :key="index">
<input type="checkbox">
</div>
</div>
</template>
<script>
export default {
props: ['options']
}
</script>
The issue lies in my v-model
not correctly retrieving the value from the group.