M
M
Martovitskiy2021-10-13 20:10:41
Vue.js
Martovitskiy, 2021-10-13 20:10:41

Why is only the last iteration of the v-for output?

Why does v-for output only the last iteration?

<el-table-column>
   <template v-for="(item, key) in managers" slot-scope="props">
      <table class="template-table">
         <thead class="stable">
            <tr>
               <th>{{ item.name }}</th>
               <th></th>
               <th></th>
               <th></th>
               <th></th>
            </tr>
         </thead>
      </table>
   </template>
</el-table-column>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Chipekwe, 2021-10-13
@XanXanXan

v-for= is added to the element that needs to be drawn multiple times.
And in this code it turns out that it draws several tables with one line. v-for=tr

S
scrz, 2021-10-15
@scrz

For <el-table-column>one template render is intended. If you want to iterate the columns of the table, then the v-for
iteration must be written in<el-table-column>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question