<template> <view> <viewv-for="(item,index) in 10"> <!-- 通过%运算符求余数,实现隔行换色的效果 --> <view:class="'list-'+ index%2">{{index%2}}</view> </view> </view></template><script>exportdefault{data(){return{}}}</script><style>.list-0{background-color:#aaaaff;}.list-1{background-color:#ffaa7f;}</style>

网友评论