Home  >  Q&A  >  body text

Vuetify autocomplete display

I am new to vue 3. I'm trying to use vuetify autocomplete feature in my project. I consulted the official documentation of vuetify. Autocomplete shows [object object]. Thanks in advance.

<script>
    import { Form, Field } from 'vee-validate';


    export default {
        components: {
            Form,
            Field,
        },
        setup(props) {
            
        },
        data() {
            return {
                add: {
                    id: 1,
                },
                states: [
                    { name: 'Florida', id: 1 },
                    { name: 'Georgia', id: 2 },
                    { name: 'Nebraska', id: 3 },
                    { name: 'California', id: 4 },
                    { name: 'New York', id: 5 },
                ],
            };
        },
        methods: {
            
            },

        
    };
</script>
<template>
<v-row>
    <v-autocomplete
    v-model="add.id"
    :items="states"
    item-text="name"
    item-value="id"
    chips
    deletable-chips
    filled
></v-autocomplete>
</v-row>
</template>

How to display status name instead of [object object]

P粉658954914P粉658954914299 days ago500

reply all(2)I'll reply

  • P粉239089443

    P粉2390894432023-12-26 00:36:44

    Add return-object

    in v-autocomplete
    <v-autocomplete
        v-model="add.id"
        :items="states"
        item-text="name"
        item-value="id"
        chips
        deletable-chips
        filled
        return-object
    ></v-autocomplete>

    reply
    0
  • P粉693126115

    P粉6931261152023-12-26 00:02:26

    If you are using Vuetify 3, you should use "item-title" instead of "item-text". And I think Vuetify 2.6 is not compatible with Vue 3.

    If this works for you, please provide feedback.

    reply
    0
  • Cancelreply