I have a requirement to display 2 items from an array in one table TD ( column ). Below is the example mock data provided:
agendas: [
[
{
tag: 'p',
class: 'm-agenda__date',
value: 'Tue, 12 Oct'
},
{
tag: 'p',
class: 'm-agenda__time',
value: '8am - 12pm',
},
{
tag: 'h3',
class: 'm-agenda__subheading',
value: 'Subheading of the Sub-Section'
},
{
tag: 'p',
class: 'm-agenda__description',
value: 'Ipsum dolor sit amet, consectetur adi piscing elit duis volutpat, urna in. Lorem ipsum dolor sit amet.'
}
]
]
Below is the Vue structure being used:
<table class="m-table__table">
<tbody>
<tr
v-for="(agenda, index) in agendas" :key="index"
class="m-table__row"
>
<td class="m-table__column" v-for="(column, index) in agenda" :key="index">
<template
v-slot:column='{ column }'
>
<template v-if="column.tag">
<tag
:is="column.tag"
:class="column.class"
>
{{column.value}}
</tag>
</template>
</template>
</td>
</tr>
</tbody>
</table>
At present, the data from the mock is displayed in 4 td's, but there is a request to combine the last 2 objects of the array into a single td.