1. 程式人生 > >雙向綁定

雙向綁定

pan method src itl UNC scripts name this cti

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>

雙向綁定