zoukankan      html  css  js  c++  java
  • v-bind的动态绑定

    v-bind Vue的指令 动态绑定为属性赋值
      语法: v-bind:属性(参数)=" 变量值"
    <!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="../js/vue.js"></script>
        <style>
            .red {
                color: blue;
            }
            .font {
                font-size: 40px;
            }
        </style>
    </head>
    <body>
        <div v-html="rawHtml" id="app" v-bind:class="{red:isRed,font:isFont}"></div>
        <div id="app1" v-bind:style="{color:color,fontSize:fontSize}">listen and point</div>
        <script>
            var vm = new Vue({
                el: "#app",
                data: {
                    rawHtml: "<span>hello world111</span>",
                    isRed:true,
                    isFont:true,
                }
            });
            var vm1 = new Vue({
                el: "#app1",
                data: {
                    color: "red",
                    fontSize: '50px',
                }
            });
        </script>
    </body>
    </html>
  • 相关阅读:
    自定义指令directive
    angular中的表单验证
    ng-init,ng-controller,ng-model
    Redis执行lua脚本,key不存在的返回值
    消息队列对比
    数据库设计范式
    网络IO模型
    .NET 线程、线程池
    异步和多线程
    Memcache知识点
  • 原文地址:https://www.cnblogs.com/kukai/p/12382340.html
Copyright © 2011-2022 走看看