NuxtN
Nuxt16mo ago
Galexrt

Vue Type issue for v-model on array element

Hi, this isn't directly a Nuxt question, but a Vue typescript question.
I'm getting this type error for when I have an array of elements that are not undefined, e.g., string[], but when I use v-for on that array via the index as I have to be able to update the array value.

            <ul v-else role="list" class="divide-y divide-gray-100 dark:divide-gray-800">
                <DocumentCommentEntry
                    v-for="(comment, idx) in data.comments"
                    :key="comment.id"
                    v-model="data.comments[idx]"
                    @deleted="removeComment($event)"
                />
            </ul>

I'm not sure how to fix this error as, e.g., using ! after the array index is not recognized.
image.png
Was this page helpful?