vue之动态绑定class

只记载自己常用的两种简单方法,在data中给isfooter赋值,判断等式是否成立
还有更多方法请参考: https://cn.vuejs.org/v2/guide/class-and-style.html

方法一:


<div :class="{'footer':isfooter===true}">动态绑定class</div>

方法二:


<div :class="[isfooter===true?'footer':'content']">动态绑定class</div>

posted @ 2020-05-05 15:56  Lucyy  阅读(232)  评论(0编辑  收藏  举报