Has anybody tried dynamic table rowspan in vue.js?
Below is data
{
date: '2018-08-14',
temp_que : 120,
},
{
date: '2018-08-14',
temp_que : 120,
},
{
date: '2018-08-15',
temp_que : 120,
},
{
date: '2018-08-15',
temp_que : 120,
},
Below is html vue
<template v-for="(item, i) in list">
<tr>
<td
:rowspan=""
v-if=""
class="text-center"
v-text="item.date"
></td>
</tr>
</template>
Question is how I put rowspan when date got same date?
First,you need to count the number of same date, like this: { date: '2018-08-14', same_num:'count', temp_que : 120, },
<template >
<tr v-for="(item, i) in list">
<td
:rowspan="item.same_num"
v-if="!i? true:item[i-1].date==item[i].date? '':true"
class="text-center"
v-text="item.date"
></td>
</tr>
</template>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With