javascriptvue.jsnuxt.jsnuxt3.js

v-for loop is not working in nuxt 3 project


I am trying to bind some mock data saved in a variable called whatsHappeningItems that I have in my script as a ref to send into a card component I have. When I do the v-for="whatsHappening in whatsHappeningItems" as shown:

I get this error message:

[vue/valid-v-for] Custom elements in iteration require 'v-bind:key' directives.

const whatsHappening: {
title: string;
count: string;

}

Anyone know why this is happening?


Solution

  • it's eslint add something like this

    <...
      v-for="(whatsHappening, index) in whatsHappeningItems"
      :key="index"
      ....