zoukankan      html  css  js  c++  java
  • vue 绑定 class 和 内联样式(style)

     <div id="app31">
            <!--多个属性 ,号隔开-->
            <!-- v-bind:style="{fontSize: fontSize + 'px'}"   绑定内联样式-->
            <!--v-bind:class="{Class1:isActive}"  class1+bool   class需要我们自己定义  绑定一个class-->
            <div v-bind:id="id" v-bind:title="title" v-bind:style="{fontSize: fontSize + 'px'}" v-bind:class="{Class1:isActive}"
    v-on:click="GetInfo(id+title)">{{ info }}</div> // 传参 </div>

      实现:

    new Vue({
            el: "#app31",
            data() { 
                return {
    
                    info: '111',
                    id: 121321,
                    title: '222',
                    isActive: true,   // 是否生效
                    fontSize:40
                }
            },
            //data: {
               
            //},
            methods: {
                GetInfo: function (e) {
                    alert(e);
                }
    
            }
        });
    

      

  • 相关阅读:

    快排
    排序算法
    运算符
    二叉树
    递归
    队列
    栈(没写完)
    绘制双坐标轴的图形3-不同的plot类型
    绘制双坐标轴的图形2-不同的plot类型
  • 原文地址:https://www.cnblogs.com/hnzheng/p/9143170.html
Copyright © 2011-2022 走看看