I have a custom Vue component (vcheck) that has a checkbox with a label:
<input
v-model="val"
type='checkbox'
:true-value="trueValue"
:false-value="falseValue"
id="v-check"
>
<label for="v-check">{{val == trueValue ? displayChecked : displayUnchecked}}</label>
but the problem is when I have multiple instances (in the parent component), the IDs of the checkboxes clash:
<vcheck v-model="val1" display-checked="Yes" display-unchecked="No"></vcheck>
<vcheck v-model="val2" display-checked="Tested" display-unchecked="Untested"></vcheck>
So when i click the 2nd checkbox label, the 1st one changes (since they both have the same ID). At the moment I removed IDs and just using @click
event on labels. But is there a way to generate unique IDs for every instance of the component?