14

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

0

1 Answer 1

18

Try using the change event instead:

<v-checkbox v-model="todo.complete" @change="todo.save()" :label="todo.title" />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.