Recently, I started using VueJs and encountered an object that contains arrays. One of the tasks I need to accomplish is to display the total sum of all amounts in one of the columns of the table. Here is my table structure:
<tr v-for="(transaction,index) in transactions" >
<td>{{ index }}</td>
<td>show sum of all amount here</td
</tr>
Here is a snippet of the transaction data:
026b148e-c7dd-4891-b4d1-15a492c971a4: [
{
id: 106,
type: "income",
created_at: "2020-06-28 13:44:08",
updated_at: "2020-06-28 13:44:08",
amount: 10,
description: null,
type_of_pay: "group",
invoice_number: "026b148e-c7dd-4891-b4d1-15a492c971a4",
},
{
id: 107,
type: "income",
created_at: "2020-06-28 13:44:08",
updated_at: "2020-06-28 13:44:08",
amount: 1,
description: null,
type_of_pay: "group",
invoice_number: "026b148e-c7dd-4891-b4d1-15a492c971a4",
package: {}
}
],
I'm looking for a simple and clear solution to achieve this task. Any suggestions?