2

I'm creating a form using Vuetify with a dropdown option, however I want to get the dropdown choices from a table in my DB instead of hardcoding the options in.

It seems to be working, meaning that every new entry into the DB table increases the # of options I have in the dropdown. However, all it displays is [object Object]. How can I actually get it to display the actual value?

enter image description here

The dropdown component inside the template tag:

<v-card>
    <v-container>
        <v-col class="d-flex" cols="12">
            <v-select
            :items="allDropdownTypes"
            label="Project Type"
            >
            </v-select>
        </v-col>
    </v-container> 
</v-card>

The prop:

    props: {
        allDropdownTypes: Array
    },

My blade template:

<div>
    <project-form-v2 
    :all-dropdown-types="{{ $allDropdownTypes }}"
    >
    </project-form>
</div>
2
  • 1
    Does this answer your question? How do you display a name in v-select for a vue-dropdown? Commented Feb 5, 2020 at 11:50
  • [object Object] is simply the default return value when converting an object to a string. You can see the the content of your object when converting to string by using JSON. stringify(). For this purpose, kindly read up here Commented Feb 5, 2020 at 15:26

1 Answer 1

1

This fixed it:

<v-card>
    <v-container>
        <v-select
        :items="allDropdownTypes.map(a => a.value)"
        label="Project Type"
        >
        </v-select>
    </v-container>
</v-card>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.