vue动态添加:style和:class样式
一开始我是参考下面那个文章的,但是实现不了,改成这样就行了。
:style三元表达式:
<div class="detailAll" :style="'justify-content:'+(number==0?'space-around':'flex-start')"></div>
:class对象形式,前面是类名,后面是条件。条件成立则使用对应的样式
<view :class="{'couponLeft' : (index+4)%4==0 , 'couponLeft2': (index+4)%4==1, 'couponLeft3': (index+4)%4==2, 'couponLeft4':(index+4)%4==3}">