[Vuejs]-Conditional v-bind:check in vuejs

0👍

I don’t think this will work out, as the call is asynchronous. You should try to bind the state of the checkbox to a variable, and v-model the checkbox to it, like:

<input type="checkbox"
value="{{$complaint->complaintID}}"
:v-model="isChecked" 
disabled>

And then, in the callback of the AJAX function:

if (response.data.length > 0) {
  self.isChecked = true
}

You will need to solve some issues, like finding another way to pass the complaintID to the AJAX function (using Components and Props, maybe?). Check this: https://vuejs.org/guide/forms.html#Checkbox

Leave a comment