Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

birdietorerik's avatar

Set default value

I am using v-select (vue) But when my form is displayed, its show blank... Must enter a item from dropdown, But want to show 1 item in list as default

How do i do this

  <v-select
          name="roles"
          label="title"
          :key="'roles-field'"
          :value="entry.roles"
          :options="lists.roles"
          :closeOnSelect="true"
          multiple
          @input="updateRoles"
          @search.focus="focusField('roles')"
          @search.blur="clearFocus"
  />
0 likes
2 replies
martinbean's avatar

@birdietorerik If this is Vuetify, then you probably should be using the v-model directive to both set the value and map selected values to a prop in your component:

<script>
let role = ref('name of default role here');
</script>

<template>
  <v-select
    v-model="role"
  />
</template>
1 like
mostafa-amine's avatar

If the compnent is not displayed then check if you import the compnent correctly it can be the problem

Please or to participate in this conversation.