vuetify: v-chip v-model using dynamic lists

Viewed 13085

I have a vuetify component to display a list of tags.

<template>
    <div>
        <v-chip 
            v-for="tag in tags" 
            :key="tag.id" 
            v-model="???"
            @input="onClose(tag)"
            close
        >
            {{tag.name}}
        </v-chip>
    </div>
</template>

<script>
    export default {
        name: 'TagIndex',
        props: ['tags'],

        methods: {
            onClose(tag){
                console.log('close tag')
            }
        }
    }    
</script>

The vuetify documentation says:

Closable chips can be controlled with a v-model.

I do not understand what kind of object I need to specify as a model for each tag if the list of tags is dynamic.

I tried to create an array based on a list of tags:

data(){
  return {
    clonedTags: this.tags.map((t) => {return true})
  }
}

But has failed

1 Answers
Related