Vuetify autocomplete display
P粉658954914
P粉658954914 2023-12-25 11:00:26
0
2
492

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粉658954914
P粉658954914

reply all(2)
P粉239089443

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>
P粉693126115

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!