[Vuejs]-V-for loop throws TypeError: Cannot read property of null in VueJS application

4👍

You should move v-if directive into wrapper element.

<template v-if="topic">
  <v-chip v-for="(tag, iii) in topic.tags" :key="iii"
    @click:close="removeTag(tag.id)" close
    color="primary" text-color="white" class="mr-1">{{ tag.name.en }}</v-chip>
</template>

https://v2.vuejs.org/v2/guide/conditional.html#v-if-with-v-for

When used together with v-if, v-for has a higher priority than v-if.

👤Sina

Leave a comment