请问这是什么原因呀?
这个由于this作用域的问题,你的代码中的this.arr的this代表着是当前的Vue实例,所以是undefined,你换成arr,去掉this. 试试?
这是代码 <body> <div id="app"> <div> {{msg}} <p>{{msg1}}</p> </div> </div> <script> var arr = 'new test' var app= new Vue({ el:'#app', data:{ msg:'hello vue!!', another:'GoodBey vue!!' }, watch:{ msg:function(newval,oldval){ console.log('newval is:'+newval) console.log('oldval is:'+oldval) }, }, computed:{ msg1:function(){ return 'computed:' + this.msg +' , '+ this.another + this.arr } }, methods:{ } }) </script> </body>