I have a checkbox with a state based on todo.complete
todo.save()
persists the current complete value to the database. However @click
seems to be triggered before the v-model binding updates todo.complete
<v-checkbox v-model="todo.complete" @click="todo.save()" :label="todo.title" />
I have to do it like this to make it work:
<v-checkbox v-model="todo.complete" @click="todo.complete = !todo.complete; todo.save()" :label="todo.title" />
Is there some way to execute todo.save()
after v-model has been updated. something like @click.after
Try using the change
event instead:
<v-checkbox v-model="todo.complete" @change="todo.save()" :label="todo.title" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With