Setting a checkbox as checked with Vue.js

To set the state of the checkbox, you need to bind the v-model to a value. The checkbox will be checked if the value is truthy. In this case, you are iterating over modules and each module has a checked property.

The following code will bind the checkbox to that property:

<input type="checkbox" v-model="module.checked" v-bind:id="module.id">

If you’d like to know more about how v-model works in this situation, here’s a link to the documentation about Form Input Binding.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)