这是一张Vue表。
<table>
<tr v-for="height in chartHeight" track-by="$index">
<td class="item" v-for="width in chartWidth" track-by="$index">
index of row and column here
</td>
</tr>
</table>
高度$index
被宽度内部覆盖。如何访问$index
?
答案 0 :(得分:2)
<table>
<tr v-for="(hid, height) in chartHeight" track-by="hid">
<td class="item" v-for="(wid, width) in chartWidth" track-by="wid">
{{ hid }}, {{ wid }}
</td>
</tr>
</table>