首页 > 代码库 > vue之v-bind:style

vue之v-bind:style

<div class="collect" @click="collected=!collected">
  <i class="fa fa-heart" :style="{‘color‘: collected ?‘rgb(240, 20, 20)‘:‘rgb(147, 153, 159)‘}"></i>
  <span class="text" :style="{‘color‘: collected ?‘rgb(77, 85, 93)‘:‘rgb(147, 153, 159)‘}">{{collected?‘已收藏‘:‘收藏‘}}</span> 
</div>

 

vue之v-bind:style