v-model:双向数据绑定
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>v-model</title>
<script src="../vuejs/vue.min-1.0.28.js"></script>
</head>
<body>
<div id="app">
{{text}}<br/>
用户名:<input type="text" name="name" v-model='user.name'><br/>
密 码:<input type="password" name="pwd" v-model='user.pwd'><br/>
<button v-on:click='getUser()'>注册</button>
</div>
<script type="text/javascript">
var vm = new Vue({
el:'#app',
data:{
text:'注册用户',
user:{name:'',pwd:''}
},
methods:{
getUser:function(){
alert(this.user.name+"====="+this.user.pwd);
}
}
});
</script>
</body>
</html>