[Vuejs]-True / false in input (vuejs), probably without v-model

2👍

You can using @change on checkbox.

Example: https://codepen.io/koei5113/pen/ZEXLLgL

<input type='checkbox' :value='item.id' v-model='checkBrands' @change="changeEvent">
methods: {
    ...,
    changeEvent($event) {
        console.log($event.target.checked);
    }
}

In this example you can see your v-model still working and you still can check checkbox status by the change event.

1👍

v-model ignore the :value in the input. You need to use :checked and @change

For example, and when you emit the change event use your function.

<input type="checkbox" :checked="value" @change="changeArrayNotValue" />
👤MuXeD

Leave a comment