[Vuejs]-How to uncheck a checkbox bound to a vuex store state array item?

0👍

binding to the input with v-model

  <input
    type="checkbox"
    :value="item.isCompleted"
    @input="handleComplete(index)"
      />

handle checkbox state change with method

handleComplete(index) {
      this.$buefy.dialog.confirm({
        title: "Confirm",
        message: "This action cannot be undone from the priorities list. Do you want to continue?",
        type: "is-danger",
        size: "is-small",
        onConfirm: async () => {
            // I suppose this is mutating the state and that the store will get updated automatically then
            await this.confirmComplete(this.priorities[index]);
        },
        onCancel: () => {
            // TODO: use store actions to mutate state
            this.priorities[index] = false
        }
      });
    },

Main part was about the template binding

Leave a comment