[Vuejs]-How to fix duplicate value found in v-for?

0👍

The track-by in v-for already considers you are referencing a property of the iterated variable (in your case, item), so no need for track-by="item.id", just do:

<tr v-for="item in basketItems" track-by="id">

If you see nothing after this, I suggest you try simply printing the name:

<table>
  <tr v-for="item in basketItems" track-by="id">
    <td>{{ item.name }}</td>
  </tr>
<table>

Because, remember, the browsers won’t render <tr>s that are not under a <table>.

Leave a comment