v-select component is not showing selected option in v-select box

1.8k Views Asked by At

I am facing one problem while working with v-select component. V-select component is not showing selected item... It is showing options in dropdown but after selecting it is showing blank in select box.

This is the problem-

enter image description here

Dropdown is showing.. but not showing anything after selecting.

enter image description here Like this.. It is blank.

Here is my code

<template>
  <div>
    <v-select
      label="broadcast"
      v-model="broadcast_"
      :options="broadcasters"
      :reduce="(broadcast) => broadcast.id"
    >
      <template v-slot:option="option">{{ option.name }}</template>
    </v-select>
  </div>
</template>
        
<script>
import Vue from "vue";
import vSelect from "vue-select";
Vue.component("v-select", vSelect);
    
export default {
  data() {
    return { 
      broadcasters: [
        {
          name: "ABC Live",
          id: 1,
        },
        {
          name: "Disney",
          id: 3,
        },
        {
          name: "24x7 Broadcast",
          id: 4,
        },
      ],
      broadcast_: "",
    };
  },
  watch: {
    broadcast_(val) {
      console.log(val);  //It prints desire data (i.e broadcast id)
    },
  },
};
</script>
1

There are 1 best solutions below

1
Fernando Del Cantão On

I don't know exactly what you wanted with your :reduce statement. But if you change your code where

label="broadcast"

to

label="name"

or

label="id"

You will get the text in the selectbox