mrperfectionist
2 months ago
242
4
Vue

Value is not binding for Checkbox: Vue

Posted 2 months ago by mrperfectionist

I want to bind the checkbox value with my database value true(1)/false(0)

<input type="checkbox" :checked="todo.todo_status==1" @change="check($event)" v-model="todo.todo_status">

If I cut v-model then :checked is working.

<li v-for="(todo,index) in todoList" :key="todo.index">
  {{ todo.todo_status }}
</li>

This is giving me correct result.

TodoList in Data:

todoList: [{ id: '', todo_title: '', todo_status: false, edit: false }],

Now checkbox is always checked!!!! but todo_status is zero!!!

Please sign in or create an account to participate in this conversation.