• vue 属性绑定


    <!-- 绑定属性 -->
     
    <img v-bind:src="url" />
     
    <br>
    <img :src="url" />
     
    <br>
     
    <br>
    {{h}}
     
     
    <!-- 绑定html -->
     
     
    <div v-html="h">
     
    </div>
     
     
    <!-- 绑定数据的另一种方法 -->
     
    <div v-text="msg">
    </div>
     
     
     
     
     
    <!-- v-bind:class :class的使用 -->
     
     
    <div v-bind:class="{'red':flag}">
     
    我是一个div
    </div>
     
    <br>
    <br>
     
    <div :class="{'red':flag,'blue':!flag}">
     
    我是另一个div
    </div>
     
     
    <br>
    <br>
    <!-- 循环数据 第一个数据高量 -->
    <ul>
    <li v-for="(item,key) in list">
    {{key}}---{{item}}
    </li>
    </ul>
     
    <br>
    <br>
    <ul>
    <li v-for="(item,key) in list" :class="{'red':key==0,'blue':key==1}">
    {{key}}---{{item}}
    </li>
    </ul>
    <br>
    <br>
     
     
    <!-- v-bind:style :style的使用 -->
     
    <div class="box" v-bind:style="{'width':boxWdith+'px'}">
     
    我是另一个div
    </div>
     
     
    </div>
    </template>
     
    <script>
    export default {
    data () { /*业务逻辑里面定义的数据*/
    return {
    msg: '你好vue',
    title:'我是一个title',
    url:'https://www.itying.com/themes/itying/images/logo.gif',
     
    h:'<h2>我是h2</h2>',
    list:['1111','2222','3333'],
    flag:false,
    boxWdith:500
    }
    }
    }
    </script>
     
     
    <style lang="scss">
    .red{
    color: red;
    }
    .blue{
    color:blue;
    }
    .box{
     
    height: 100px;
     
    100px;
     
    background: red;
    }
     
    </style>
  • 相关阅读:
    Redis安装
    mysql 存储过程与存储函数
    mysql 常用函数
    cpu-z笔记本加条子
    centos上网络服务起不来network.service failed
    centos/redhat命令行上传下载文件
    docker删除已经停止的容器
    centos/redhat/ubuntu不同之处
    部署lamp动态网站(图解)
    写交互式脚本时,遇到到报错:not a regular file
  • 原文地址:https://www.cnblogs.com/onda/p/9199631.html
Copyright © 2020-2023  润新知