:src 三目运算
<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,}
轉載于:https://www.cnblogs.com/nns4/p/8550647.html
總結
- 上一篇: Xenu使用随记
- 下一篇: 二叉树的前序,中序,后序,层序遍历的递归