2

I have a v-data-table and I am trying to print my headings, but with my code they are all appearing grouped into one column instead of across the entire table.

<template v-slot:header>
    <thead>
        <tr>
            <div v-for="(itm, i) in hdrs" :key="i">
              <th>
                {{itm.value}}
              </th>
            </div>
        </tr>
    </thead>
</template>

Can anyone offer a suggestion as to how to resolve this issue please?

Dustin Cook
  • 1,215
  • 5
  • 26
  • 44

1 Answers1

1

the loop should be done in the th elements and remove the div one :

<tr>
  <tempalte v-for="(itm, i) in hdrs">
     <th v-if="someCondition">
      {{itm.value}}
     </th>
  </template>
</tr>
Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164