vue设置动态style或class

动态设置背景图

<div :style="{backgroundImage: `url(${(scope.row.budget_type == 2) ? scope.row.face : scope.row.formFace })`}">
    
</div>

 

动态设置style

<i class="el-icon-caret-bottom" :style="{'color':(!!screenFlag?'#00bad0':'#c0c4cc')}"></i>

 

固定class和动态class共存

<div :class="['add-redpacket-box',screenType == 2?'blacklist-outbox':'']">
    <p>提示</p>
</div>

 

posted on 2020-04-16 11:43  活在当下zql  阅读(6945)  评论(0)    收藏  举报