zoukankan      html  css  js  c++  java
  • Vue Class样式和style样式编写

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            .active {
                color: green;
            }
    
            .delete {
                background: red;
    
            }
    
            .error {
                font-size: 35px;
            }
        </style>
    </head>
    
    <body>
    
        <div id="app">
            <h3>Class绑定,V-bind:class 或 :class</h3>
    
            <p v-bind:class="activeClass">字符串表达式</p>
            <!-- key值是样式名,value值是data中绑定的属性
            当isDelete为true的时候,delete就会进行渲染
            -->
            <p v-bind:class="{delete:isDelete,error:isError}">对象表达式</p>
    
            <p :class="['active','error']">数组表达式</p>
    
            <h3>Style绑定,V-bind:style 或 :style</h3>
            <p :style="{color:activeColor}">style样式</p>
    
        </div>
        <script src="./node_modules/vue/dist/vue.js"></script>
        <script>
    
            var vm = new new Vue({
                el: '#app',
                data: {
                    activeClass: "active",
                    isDelete: true,
                    isError: false,
                    activeColor:'red'
                }
            })
        </script>
    </body>
    
    </html>
    

      

  • 相关阅读:
    对结对编程的测试
    用例
    结对编程 一
    个人项目总结与结对编程的开始
    7-6随便写写
    7-5个人日报
    7-4个人报告
    7.1-7.3个人日报
    6-30个人日报
    6-29个人日报
  • 原文地址:https://www.cnblogs.com/guozhe/p/14849156.html
Copyright © 2011-2022 走看看