v-model:双向绑定的值。这个值一改变,凡是用到这个值得地方都改变
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <script src="~/Scripts/vue/vue.js"></script> <title>Index</title> </head> <body> <div id="root" v-bind:title="title"> {{msg}} <input v-model="msg" /> <div>{{msg}}</div> </div> </body> </html> <script type="text/javascript"> new Vue({ el: "#root", data: { msg: "hello word", title: "我是标题" }, methods: { handle: function () { this.msg = "你好" } } }); </script>