vue 根据数值判断颜色

vue 根据数值判断颜色_第1张图片
1.首先style样式给两种颜色 用:class 三元运算符判断出一种颜色
第一步:在style里边设置两种颜色

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

在取数据的标签 里边 判断一种颜色

:class="item.quote.current >0 ?'orange': 'green'"
 
        
{{ item.quote.name }}
{{ item.quote.current }}

{{ item.quote.chg }}

你可能感兴趣的:(vue,vue.js,javascript,前端)