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

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

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

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

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

第一步:在style里邊設置兩種顏色

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

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

: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;
    }
 
 
//標簽------------------
 
 
 
v-for='item in xxxxxx'
:style="{ '--color': item.background }"

總結

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

相關文章

最新評論