vue中计算属性的get与set方法
在vue的计算属性中,所定义的都是属性,可以直接调用
正常情况下,计算属性中的每一个属性对应的都是一个对象,对象中包括了set方法与get方法
computed:{
fullNname:{
set:function(newValue){
console.log(newValue)
}
get:function(){
console.log(this.name)
}
}
}
而绝大多数情况下,计算属性没有set方法,是一个只读属性
此时计算属性可以简写
computed:{
fullName:function(){
console.log(this.name)
}
}