• vue中class样式与内联样式


    (1):style使用

    <div class="score" :style="{ color: colorComputed(item.status) }">{{item.score}}</div>
    computed: {
        colorComputed() {
          return (status) => {
            if (status === 1 || status === 2) {
              return '#FF1E00';
            }
            if (status === 3 || status === 4) {
              return '#F7B500';
            }
            if (status === 5) {
              return '#00DA62';
            }
          };
        }
      },
     <template slot-scope="scope">
        <span :style="{ color: colorComputed(scope.row.hegezhuangtai) }">{{ scope.row.shijiedefen }}-{{ scope.row.hegezhuangtai }}</span>
     </template>
    
     computed: {
        colorComputed() {
          return (text) => {
            if (text === '优秀') {
              return '#00AE65';
            }
            if (text === '良好') {
              return '#FA8C15';
            }
            if (status === '不合格') {
              return '#E62512';
            }
          };
        }
     },

    (2):class用法

    <i
      class="my-radio"
      :class="[thirdItem.isChecked ? 'is-checked' : '']"
      @click="selectScore(shipInfo,item, subItem, thirdItem)"
    ></i>
    <ul class="position-nav" :class="{'fixed-menu': fixedMenu}" v-if="shipInfos.length>0">
      <li
         class="nav-item"
          :class="menuClickIndex === index ? 'active' : ''"
          @click="clickMenu(index)"
          v-for="(shipInfo, index) in shipInfos"
          :key="index"
           >
        {{ shipInfo.yinsufenlei }}({{ shipInfo.quanzhong }})
      </li>
    </ul>
  • 相关阅读:
    MYSQL存储引擎
    微信公众号自定义菜单
    TCP 三次握手与四次挥手
    微信扫码关注公众号并登录网站
    redis scan命令使用
    [转]Maven多模块结构下版本管理的正确姿势-revision
    线程间的协作wait,notify,sleep,yield,join
    GIT 撤销操作
    Kafka学习理解-listeners配置
    Kafka 简介梳理
  • 原文地址:https://www.cnblogs.com/guwufeiyang/p/13083293.html
Copyright © 2020-2023  润新知