[Vuejs]-Is there a way to set the default value of a v-select to an entire table

0👍

I think I understand the issue now: to have "Select All" option (and by consequence, all options) selected when the page loads.

All the "Select All" option does is toggle the v-model having all the items, or none of the items. To have "Select All" selected on page load simply requires that the v-model have all items assigned to it as it’s initial value.

Using the example code from the Vuetify docs

<v-select v-model="selectedFruits" :items="fruits" multiple>
data: () => ({
  fruits: ['Apples', 'Apricots', 'Avocado', 'Bananas'],
  selectedFruits: ['Apples', 'Apricots', 'Avocado', 'Bananas']
})

Or, alternatively

data: () => ({
  fruits: ['Apples', 'Apricots', 'Avocado', 'Bananas'],
  selectedFruits: []
}),
mounted() {
  this.selectedFruits = this.fruits.slice()
}

working sandbox example

Leave a comment