sagalbot / vue-select

Everything you wish the HTML <select> element could do, wrapped up into a lightweight, extensible Vue component.
https://vue-select.org
MIT License
4.62k stars 1.33k forks source link

How to set default value #1637

Closed mithun-infodigita closed 2 years ago

mithun-infodigita commented 2 years ago
<template>
  <v-select
    v-model="payment_methods_ids"
    :options="payment_methods"
    label="name"
    multiple
    placeholder="Select"
    class="payment_methods__select2"
    :reduce="(payment_method) => payment_method.id"
  >
  </v-select>
</template>

<script>
import vSelect from "vue-select";
import "vue-select/dist/vue-select.css";

export default {
  components: {
    vSelect,
  },

  data() {
    return {
payment_methods: [
  {
    id: 1,
   name: 'Master Card',
  },
 {
    id: 2,
   name: 'Visa' ,
  },
 {
    id: 2,
   name: 'Paypal' ,
  },
],
      payment_methods_ids: [],
    };
  },
};
</script>
krishkireeti commented 2 years ago

https://stackoverflow.com/questions/51392719/set-initial-vuetify-v-select-value Please refer this link for default value hope it is useful