Below I will share with you a method of using v-for in vue to traverse a two-dimensional array. It has a good reference value and I hope it will be helpful to everyone.
is as follows:
<table cellpadding="0" cellspacing="0" class="clearfix bigTable" id='downloaddata'> <tr v-for='(item, index) in data'> <template v-for='items in item'> <template v-for='(itemss, indexs) in items' v-if='indexs !== "type"'> <td>{{itemss}}</td> </template> </template> </tr>
Among them, the data data is:
this.data = [ [ { type: '', name: '资产', start: '期末余额', end: '期初余额' }, { type: '', name: '负债和所有者权益(或股东权益)', start: '期末余额', end: '期初余额' } ], [ { type: '', name: '资产', start: 125000, end: 12534567 }, { type: '', name: '负债', start: 125000, end: 12534567 } ], [ { type: '资产', name: '货币资金', start: 125000, end: 12534567 }, { type: '负债', name: '应付短期融资款', start: 125000, end: 12534567 } ], [ { type: '资产', name: '其中:客户存款', start: 125000, end: 12534567 }, { type: '', name: '所有者权益(或股东权益)', start: 125000, end: 12534567 } ], [ { type: '资产', name: '', start: '', end: '' }, { type: '所有者权益(或股东权益', name: '实收资本(或股本)', start: 125000, end: 12534567 } ], [ { type: '资产', name: '资产总计', start: 111, end: 11 }, { type: '所有者权益(或股东权益', name: '资本公积', start: 125000, end: 12534567 } ] ]
Result:
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Commonly used request method aliases based on Axios (detailed explanation)
data-[*] in Bootstrap Arrangement of attributes
vue2.0 Style change display method based on status value
The above is the detailed content of How to traverse a two-dimensional array using v-for in vue. For more information, please follow other related articles on the PHP Chinese website!