码迷,mamicode.com
首页 > 其他好文 > 详细

vue常用的指令

时间:2017-09-21 11:18:45      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:model   text   写入   font   ack   相关   mod   数据   使用   

vue常用的指令
<body>
     <div id="app">
            <h1>{{ msg }}</h1>      //数据写入方式
            <h2 v-text="msg"></h2>   //v-text写入数据,但是标签名内不能再写入其他的值,因为会被v-text覆盖
            <h2 v-once="msg">{{ msg }}</h3>   //v-once本身不能写入值,他只是制定标签内的某个相关的值不会随实例中数据动态发生改变

             <h2>{{ msg }}</h2>
            <input type="text" v-model="msg">  //使用v-model进行双向绑定 让h2标签内的数据与表单里面的数据联动

             <h2 v-bind:title="msg">给h2绑定title属性</h2>  //v-bind为h2标签绑定title属性
            <h2 :title="msg">v-bind的简写方式</h2>          //v-bind为h2标签绑定title属性的简写方式
            <h2 v-bind={id:"id", class:"class"}>绑定id,className</h2>   //v-bind也可以绑定一个对象
     </div>

    <script>
            var vm = new Vue({
                                el: "#app",
                               data: {
                                       msg: "vue中常用指令!"
                               }
            })
    </script>
</body>

vue常用的指令

标签:model   text   写入   font   ack   相关   mod   数据   使用   

原文地址:http://www.cnblogs.com/tenro/p/7567297.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!