vue.js watch监听,vue.js 监听watch
================================
©Copyright 蕃薯耀 2018年12月06日
http://fanshuyao.iteye.com/
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>vue 监听watch</title>
</head>
<body>
<div id="vue-div">
<div>姓:<input placeholder="姓" v-model="firstName"/></div>
<div>名:<input placeholder="名" v-model="lastName"/></div>
<div>全名:<input placeholder="全名" v-model="fullName"/></div>
</div>
<script type="text/javascript" src="../js/vue.min.js"></script>
<script type="text/javascript">
var vueObj = new Vue({
el: "#vue-div",
data: {
firstName : "张",
lastName : "三",
fullName : ""
},
watch:{
firstName : function(newValue, oldValue){
this.fullName = newValue + "," + this.lastName;
},
lastName : function(newValue, oldValue){
this.fullName = this.firstName + "," + newValue;
}
}
});
</script>
</body>
</html>
================================
©Copyright 蕃薯耀 2018年12月06日
http://fanshuyao.iteye.com/