zoukankan      html  css  js  c++  java
  • vue中样式

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Title</title>
    <script src="js/vue-2.4.0.js"></script>
    <style>
    .red{
    color: red;
    }
    .thin{
    font-weight: 200;
    }
    .italic{
    font-style: italic;
    }
    .active{
    letter-spacing: 0.5em;
    }
    </style>
    </head>
    <body>
    <div id="app">
    <!--第一种方式,直接传递一个数组,注意:这里的 class 需要使用 v-bind 做数据绑定-->
    <!--<h1 :class="['red','thin']">这是个超级大的大大h1!!!</h1>-->

    <!--在数组中使用三元表达式-->
    <!--<h1 :class="['red','thin',flag?'italic':'']">这是个超级大的大大h1!!!</h1>-->

    <!--在数组中使用 对象来代替三元表达式,提高代码的可读性-->
    <!--<h1 :class="['red','thin',{'active':flag}]">这是个超级大的大大h1!!!</h1>-->

    <!--在为class使用v-bind 绑定对象的时候,对象的属性是类名,由于对象的属性可带引号,
    也可不带引号,所以我这里没写引号,属性的值是一个标识符-->
    <h1 :class="classObj">这是个超级大的大大h1!!!</h1>
    </div>
    <script>
    const vm=new Vue({
    el:'#app',
    data:{
    flag:true,
    classObj:{red:true,thin:false,italic:true,active:true}
    },
    methods:{

    }
    })
    </script>
    </body>
    </html>
  • 相关阅读:
    中国电信翼聊学习(概述)
    Silverlight应用程序的本地通讯
    XmlSerialize构造函数发生错误FileNotFoundException
    使用 .NET Framework 中的函数式编程技术
    月份统计精简Sql
    poj 2421 Constructing Roads
    POJ 3026 Borg Maze
    POJ 1258 AgriNet
    zoj 1718 Building a Space Station
    zoj 1203 Swordfish
  • 原文地址:https://www.cnblogs.com/lujieting/p/10434774.html
Copyright © 2011-2022 走看看