[Vuejs]-Vue quickest way to disable and remove value from checkboxes

0👍

I don’t think this is much better than using v-on:change, but you can use watch like this:

watch: {
    masterCheckbox: function(val, oldVal) {
        if (!val) {
            this.otherCheckbox= val;
            this.andOtherCheckBox = val;
        }
    }
}

A little bit shorter though since you don’t need to put v-on:change on the master checkbox and your methods is a bit cleaner (maybe)

Demo here: https://codesandbox.io/s/nameless-cherry-mnvps?file=/src/App.vue

Leave a comment