<img :src="index==0?'../img/xz_ok.png':'../img/xz_no.png'" /> 绑定照片
<li v-for="(d,i) in datas.zong" :class="{'red':i+1==now}" @click="page(i+1)">{{i+1}}</li> 根据下标 绑定 class
三目运算 绑定 class
<style type="text/css">
.red {
color: red;
}
.yellow {
color: yellow;
}
.blue {
color: blue;
}
.green{color: green;}
</style>
<h2 :class="[a? 'yellow':b? 'red':c? 'green':'yellow']">nihao </h2>
绑定 style
<h1 :style="[a? {color:'red'}:b?{color:'blue'}:{color:'green'}]">h1</h1>
data: {
a:false,
b:false,
c:true,
}