ฉันมีอาร์เรย์ที่มีลักษณะดังนี้:
sales = [
[{'Year': 2018, 'Month': 01, 'Sale'; 512}, {'Year': 2018, 'Month': 02, 'Sale'; 1025}, ....],
[{'Year': 2017, 'Month': 01, 'Sale'; 155}, {'Year': 2017, 'Month': 02, 'Sale'; 12}, ....]
]
ฉันต้องการแสดงในตารางโดยใช้ vue:
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>2018</th>
<th>2017</th>
</tr>
</thead>
<tbody>
<tr v-for="(sale,i) in sales" :key="i">
<th scope="row">{{ ??? }}</th> //Month
<td>{{ ??? }}</td> //currentYear.Sale
<td>{{ ??? }}</td> //previousYear.Sale
</tr>
</tbody>
</table>
น่าเสียดายที่ฉันไม่รู้วิธีวนซ้ำอาร์เรย์การขายของฉันเพื่อแสดงในการลดราคาทุกแถวของตารางในปีปัจจุบันและปีที่แล้ว