filters 和 computed 这两个有什么区别吗?
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利
使用computed的时候,拼接数据中的num,返回的是string,之后在methods中定义方法,调用原数据,返回的就是string了,而不是num了,
data:{
wendu:15,
yifu:"夹克长裙"
},
computed:{
newWendu:function () {
return this.wendu = this.wendu + "℃"
}
},
components:{
"add":add,
"red":red
},
methods:{
adds:function(){
//这里返回string
console.log(typeof this.wendu)
this.wendu+=5
},
reds:function(){
this.wendu-=5
}
}