I am trying to alternate row colors in a table, but for some reason all rows end up being gray.
<table>
<tr v-for="i in item.env_vars" :style="{'background': index % 2 === 0 ? '#eee' : '#ccc' }">
<td> test1 </td>
<td> test2 </td>
<td> test3 </td>
</tr>
</table>
However, I am encountering an error in Vue admin tool:
Property or method "index" is not defined on the instance but referenced during render.
Can anyone help me identify what is causing this issue in my code?