慕移动1320446
2020-05-04 15:08
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue中的计算属性和侦听器</title>
<script src="./vue.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="root">
姓<input v-model="firstName" />
名<input v-model="lastName" />
<div>{{lastName}}</div>
<div>{{count}}</div>
</div>
<script type="text/javascript">
new Vue({
el:"#root",
data:{
firstName: '',
lastName: '',
count: 0
},
computed:{
fullName: function(){
return: this.firstName +''+ this.lastName
}
},
watch:{
fullName:function(){
this.count++
}
}
})
</script>
</body>
</html>
不应该是fullName吗
computed:{
fullName: function(){
return: this.firstName +''+ this.lastName
}
},
return 后面多了冒号(:)
computed:{
fullName: function(){
return: this.firstName +''+ this.lastName
}
}
这段代码有问题,在return 后面多了冒号(:)
computed:{
fullName: function(){
return: this.firstName +''+ this.lastName
}
},
你这段代码有问题 在return 这个后面,多了冒号(:)
vue2.5入门
146818 学习 · 657 问题
相似问题