<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="js/vue.js"></script>
</head>
<body>
<div id="example">
<p>{{msg}}</p>
<test-component></test-component>
</div>
<script type="text/javascript">
Vue.component('test-component',{
data:function(){
return {uName:''}
},
template:`
<input type="text" v-model="uName"/>
`,
watch:{
uName:function(newValue,oldValue){
console.log(this.uName);
console.log(arguments);
}
}
});
new Vue({
el:'#example',
data:{
msg:'VueJS is Awesome'
}
});
</script>
</body>
</html>
watch
最新推荐文章于 2024-08-28 14:53:03 发布