[Vuejs]-Vue watcher checked all checkbox when user deselect all?

1👍

You can use a proxy computed value with a setter:

data: () => ({
    items: ['foo', 'bar', 'fizz', 'buzz'],
    value : []
  }),
computed : {
    _value : {
      get () {
        return this.value
      },
      set (val) {
        this.value = val.length ? val : this.items
      },
    }
  }

then link your v-model to your proxy computed value:

<v-select
   v-model="_value"
   :items="items"
   multiple
></v-select>

working example: https://codepen.io/ellisdod/pen/poJqvgJ

Leave a comment