zoukankan      html  css  js  c++  java
  • class属性的computed写法示例

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
        <style>
            .red{
                color:red
            }
            .font{
                font-size: 30px;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <span :class="classObject">hello world</span>
        </div>
        <script>
           var v= new Vue({
                el:"#app",
                data:{
                    isTrue:true
                },
                computed:{
                    classObject:function(){
                        return  ['font',{'red':this.isTrue}]
                    }
                }
            });
        </script>
    </body>
    </html>
  • 相关阅读:
    性能测试概念
    接口测试概念
    SQL多表查询
    手机App测试概念
    App测试页面滑动
    自动化测试概念
    Monkey 命令
    Tomcat+JDK安装和配置
    Linux系统FTP安装、安装和使用
    Web测试方法(一)
  • 原文地址:https://www.cnblogs.com/kukai/p/12853224.html
Copyright © 2011-2022 走看看