[Vuejs]-Using v-for in a table

3👍

You can move the v-for in a template tag, that won’t be rendered in the DOM.

<tbody>
  <template  v-for="item in scrapDataEmptyRowsRemoved" :key="item">
    <tr v-if="item['Equipment Type']">
      <td class="equipt-type" colspan="6">
        Equipment Type - {{ item["Equipment Type"] }}
      </td>
    </tr>
    <tr v-else>
      <td>{{ item["Make"] }}</td>
      <td>{{ item["Model #"] }}</td>
      <td>{{ item["Bar Code"] }}</td>
      <td>{{ item["Serial #"] }}</td>
      <td>{{ item["Location"] }}</td>
      <td>{{ item["Condition"] }}</td>
    </tr>
  </template>
</tbody>

Leave a comment