在vue中style的用法

一 原生用法

style="width: 100%; margin-top: 20px"

二  三元表达式

<a :style="{color:(index==0?arr.conFontColor:'#000')}" :href="con.subTitleHref" target="_self">{{con.subTitle}}</a>

三 函数用法

  <div :style="{ height: tableRowHeight(item) }" class="tableRowCox">
              {{ item.id ? item.id : "--" }}
  </div>

四 变量用法

<div :style="{ height:conFontHeight}"> {{ item.id ? item.id : "--" }} </div>

 

posted @ 2022-01-15 10:38  肥晨  阅读(4094)  评论(0编辑  收藏  举报