I want to show table date by month. How can I loop table data? Please show me.
I tried:
<code>tableData: [
{
totalSale: 1,
totalBorrow: 0,
total: 1,
details: [
{
date: moment("2024-08-01").format("DD/MM/YYYY"),
totalSale: 1,
totalBorrow: 0,
total: 1,
},
],
},
{
totalSale: 2,
totalBorrow: 1,
total: 3,
details: [
{
date: moment("2024-09-01").format("DD/MM/YYYY"),
totalSale: 1,
totalBorrow: 0,
total: 1,
},
],
},
],
</code>
<code>tableData: [
{
totalSale: 1,
totalBorrow: 0,
total: 1,
details: [
{
date: moment("2024-08-01").format("DD/MM/YYYY"),
totalSale: 1,
totalBorrow: 0,
total: 1,
},
],
},
{
totalSale: 2,
totalBorrow: 1,
total: 3,
details: [
{
date: moment("2024-09-01").format("DD/MM/YYYY"),
totalSale: 1,
totalBorrow: 0,
total: 1,
},
],
},
],
</code>
tableData: [
{
totalSale: 1,
totalBorrow: 0,
total: 1,
details: [
{
date: moment("2024-08-01").format("DD/MM/YYYY"),
totalSale: 1,
totalBorrow: 0,
total: 1,
},
],
},
{
totalSale: 2,
totalBorrow: 1,
total: 3,
details: [
{
date: moment("2024-09-01").format("DD/MM/YYYY"),
totalSale: 1,
totalBorrow: 0,
total: 1,
},
],
},
],
My result:
1
I think you will need some extra logic on top of it to make table based on 1-30 and 1-31 since there is not enough code to help you out, you can loop for a table like following:-
<code><div v-for="data in tableData">
<tr>
<td>{{data.details[0].dat}}</td>
<td>{{data.totalSale}}</td>
</tr>
</div>
</code>
<code><div v-for="data in tableData">
<tr>
<td>{{data.details[0].dat}}</td>
<td>{{data.totalSale}}</td>
</tr>
</div>
</code>
<div v-for="data in tableData">
<tr>
<td>{{data.details[0].dat}}</td>
<td>{{data.totalSale}}</td>
</tr>
</div>
and so on