zoukankan      html  css  js  c++  java
  • 052——VUE中使用vue-cli初始化单页面应用

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <title>使用vue-cli初始化单页面应用</title>
        <script src="vue.js"></script>
    </head>
    <body>
    <!--
        directive:
            bind  inserted:插入的  update
    -->
    <div id="demo">
        <h1 v-star="color">我是标题内容</h1>
        <input type="text" v-model="color" value="color" v-focus>
        <h3 v-hide="true">{{title}}</h3>
    </div>
    <script>
        new Vue({
            el: "#demo",
            data: {
                title: "百度一下就知道了",
                color: "red"
            },
            directives: {
                star(el,bind){
                    var color=bind.value?bind.value:'red';
                    el.style.cssText="color:"+color;
                },
                focus:{
                    inserted(el,bind){
                        el.focus();
                    }
                },
                hide(el,bind){
                    if(bind.value){
                        el.style.cssText="display:none";
                    }
                }
            }
        });
    </script>
    </body>
    
    </html>
    

      

  • 相关阅读:
    括号匹配
    超级阶梯问题
    进制问题
    rwkj 1423
    next_permutation
    rwkj 1420
    uva-10392-因数分解
    uva-10305-水题-拓扑排序
    uva-10194-排序
    uva-10152-乌龟排序
  • 原文地址:https://www.cnblogs.com/yiweiyihang/p/8296635.html
Copyright © 2011-2022 走看看