• vue class或style 动态表达式


    :class="index===tableIndex-1 ? 'trBac' : ''"
     
    :style="{background:(bacFlag === 'search'?'#10A6B4':'')}"
     
    对象写法:
        html :style="{color:(index==0?conFontColor:'#000')}"
       html :style="{ color: activeColor, fontSize: fontSize + 'px' }"
    数组写法:
      html :style="[baseStyles, overridingStyles]"
      html :style="[{color:(index==0?conFontColor:'#000')},{fontSize:'20px'}]"
    三元运算写法
      html :style="{color:(index==0?conFontColor:'#000')}"
       html :style="[{color:(index==0?conFontColor:'#000')},{fontSize:'20px'}]"
     
    多重值:
      此时,浏览器会根据运行支持情况进行选择
      html :style="{ display: ['-webkit-box', '-ms-flexbox', 'flex'] }"
      
    绑定data对象:
      html :style="styleObject"
      
    data() {
        return{
          styleObject: {
            color: 'red',
            fontSize: '13px'
          }  
        }
    }
    1. class样式

        写法:class=xxx” xxx可以是字符串、对象、数组。

        字符串写法适用于:类名不确定,要动态获取。

        对象写法适用于:要绑定多个样式,个数不确定,名字也不确定。

        数组写法适用于:要绑定多个样式,个数确定,名字也确定,但不确定用不用

    1. style样式

        :style={fontSize:xxx}其中xxx是动态值。

        :style=[a,b]其中ab是样式对象。(样式对象:存在的css样式)

     
     
     
     
     
    参考:https://blog.csdn.net/weixin_30736301/article/details/100093744
  • 相关阅读:
    linux查看公网ip的方法
    统计文件或文件夹个数
    python manage.py shell
    炒冷饭,对于数据库“删除”操作大家平时都是物理删除,还是逻辑删除啊?
    SQL表名,应该用表对应资源对象的复数形式还是单数形式
    git常用命令
    Django ORM中的模糊查询
    threading 学习笔记
    class类笔记整理
    函数笔记整理
  • 原文地址:https://www.cnblogs.com/brillant/p/15839717.html
Copyright © 2020-2023  润新知