- //奇数行
- <ul>
- <li class="list-item" v-for="(item,index) in data" :class="{'active':index%2 != 1}">{{data[index].name}}</li>
- </ul>
奇数行::class="{'active':index%2 != 1}"
偶数行::class="{'active':index%2 != 0}"
active是需要添加的class
奇数行::class="{'active':index%2 != 1}"
偶数行::class="{'active':index%2 != 0}"
active是需要添加的class