‘v-model’ directives cannot update the iteration variable itself

My solution was very simple (see v-model="tags[index]"):

Instead of doing this:

<template v-for="tag in tags">
    <TagView :key="tag.key" v-model="tag" />
</template>

You should do this:

<template v-for="(tag, index) in tags">
    <TagView :key="tag.key" v-model="tags[index]" />
</template>

The reason is you cannot pass iterated object tag into v-model for modifications. Please find more info about this: Iterating a list of objects with foreach

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)