2016-08-22 67 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>