欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue如何根據(jù)數(shù)值判斷顏色

 更新時(shí)間:2024年03月20日 09:48:27   作者:戰(zhàn)斗中的老段  
這篇文章主要介紹了vue如何根據(jù)數(shù)值判斷顏色問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

vue根據(jù)數(shù)值判斷顏色

1.首先style樣式給兩種顏色 用:class 三元運(yùn)算符判斷出一種顏色

第一步:在style里邊設(shè)置兩種顏色

.green{
  color: green;
}
.orange{
  color: orangered;
}

在取數(shù)據(jù)的標(biāo)簽 里邊 判斷一種顏色

:class="item.quote.current >0 ?'orange': 'green'"
 <van-grid-item v-for="item in arrQuotes" :key="item.quote.symbol">
        <h5>{{ item.quote.name }}</h5>
        <h5 :class="item.quote.current >0 ?'orange': 'green'">{{ item.quote.current }}</h5>
        <p :class="item.quote.chg >0 ?'orange': 'green'">{{  item.quote.chg }}</p>
      </van-grid-item>

vue中偽類元素 根據(jù)數(shù)據(jù)改變顏色

//css--------------------------------
&::before {
      content: "";
      position: absolute;
      width: 5px;
      height: 12px;
      background: var(--color);//--------(--color)
      top: 4px;
      left: 0px;
      border-radius: 2px;
    }
 
 
//標(biāo)簽------------------
 
 
 
v-for='item in xxxxxx'
:style="{ '--color': item.background }"

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論