zoukankan      html  css  js  c++  java
  • v-bind:style

    <!-- <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>v-bind:style</title>
    </head>
    <body>
        <div id="box" v-bind:style="{color:activeColor,fontSize:fontSize+'px'}">v-bind:style 样式的绑定</div>
        
    </body>
    <script type="text/javascript" src="js/vue.js"></script>
    <script type="text/javascript">
        new Vue({
            el:"#box",
            data:{
                activeColor:'red',
                fontSize:30
            }
        })
    </script>
    </html> -->
    
    <!-- <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>v-bind:style</title>
    </head>
    <body>
        <div id="box" v-bind:style="styleObject">v-bind:style 样式的绑定 把style写成一个对象</div>
        
    </body>
    <script type="text/javascript" src="js/vue.js"></script>
    <script type="text/javascript">
        new Vue({
            el:"#box",
            data:{
                styleObject:{
                    color:'blue',
                    fontSize:'30px'
                }
            }
        })
    </script>
    </html> -->
    
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>v-bind:style</title>
    </head>
    <body>
        <div id="box" v-bind:style="[baseStyles, overridingStyles]">v-bind:style 样式的绑定 把style写成数组</div>
        
    </body>
    <script type="text/javascript" src="js/vue.js"></script>
    <script type="text/javascript">
        new Vue({
            el:"#box",
            data:{
                baseStyles:{
                    color:'red',
                    fontSize:'40px'
                },
                overridingStyles:{  //允许你将多个对象绑定进去,感觉就像class一样。
                    fontWeight:'bold',
                    textShadow:'5px 5px 10px #333'   //有些css属性,例如transform,需要针对不同浏览器加不同前缀,这在vuejs里是自动添加的,无需考虑;
                }
            }
        })
    </script>
    </html>
  • 相关阅读:
    SQL手工注入方法
    Python + Django 网站平台搭建之- 初识 (一)
    最新版Idea2019.3.4/2020.1完美破解
    使用 Guns 自动生成 SpringBoot + LayUI 的后台管理系统
    SpringBoot+Layui后台管理系统
    国内Maven中央仓库推荐 速度最快最好的Maven仓
    git 下载失败 中断了 继续下 怎么配置参数
    mysql 创建与授权
    jboot-admin
    自动生文器
  • 原文地址:https://www.cnblogs.com/jinsuo/p/7637849.html
Copyright © 2011-2022 走看看