美文网首页
vue 动态绑定多个class

vue 动态绑定多个class

作者: 一包 | 来源:发表于2019-12-10 20:35 被阅读0次

需要用到多个表达式来决定class的时候,使用模板字符串

 <span
            class="list-predictive-val"
            :class="
              `${item.glmProbability < 25 ? 'bg-success' : ''}${
                item.glmProbability > 50 ? 'bg-danger' : ''
              }`
            "
          >
            {{ item.glmProbability }}%
          </span>

相关文章

网友评论

      本文标题:vue 动态绑定多个class

      本文链接:https://www.haomeiwen.com/subject/ipfngctx.html