2016-08-22 80 views
0

这是一个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

你能举一个chartHeight和chartWidth的例子吗? –

回答

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>