<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>watch的使用</title> <script src="vue1.0.11.js"></script> </head> <body> <div id="app"> <input type="text" v-model="firstName"> <input type="text" v-model="lastName"> {{fullName}} </div> </body> <script> new Vue({ el:'#app', data:{ firstName:'itcast', lastName:'heima', fullName:'heima.itcast' }, watch:{//监控 'firstName':function (newval,oldval) { // console.log(newval,oldval); this.fullName=this.firstName+this.lastName; }, 'lastName':function (newval,oldval) { // console.log(newval,oldval); this.fullName=this.firstName+this.lastName; } } }); </script> </html>
vue1.0中的watch的简单使用
猜你喜欢
转载自blog.csdn.net/weixin_40593587/article/details/79311103
今日推荐
周排行