vue模板

<!DOCTYPE html>javascript

<html>css

    <head>html

        <meta charset="utf-8" />vue

        <title>模板</title>java

    </head>ide

    <script type="text/javascript" src="js/vue.js" ></script>spa

    <script>双向绑定

        window.onload = function(){调试

            //配置是否容许检查代码,方便调试,生产环境中设置为falsehtm

            Vue.config.devtools = true;  //检查代码

            Vue.config.productioinTip = false;  //有强迫症的,能够关掉生产中的提示信息

            let vm = new Vue({

                el: "#div1",

                data:{

                    msg:'hello world!!!'

                },

                created:function(){

                    alert(1111);

                }

            });

        }

    </script>

    <style type="text/css">

        [v-cloak]{

            display: none;

        }

    </style>

    <body>

        <div id="div1">

            <input type="text" v-model="msg">

            <h1>aaaa<span v-cloak>`msg`</span></h1>   <!-- 防止msg-->   

            <h1 v-text="msg"></h1>      <!--v-text  不能解析html代码-->

            <h1 v-html="msg"></h1>      <!--v-html 能够解析html代码-->

            <h2 v-once>`msg`</h2>     <!--只绑定一次,双向绑定改变不了-->

            <h3 v-pre>`msg`</h3>      <!--当须要输出{{}}时,能够不编译{{}}符号,以文本形式输出-->

        </div>

    </body>

</html>

相关文章
相关标签/搜索