2022年3月2日
Vue生命周期篇-Computed(学习笔记)
computed() 计算属性:
1.定义:要用的属性不存在,要通过已有属性计算得来。
2.原理:底层借助了Objcet.defineproperty方法提供的getter和setter。
3.get函数什么时候执行?
(1).初次读取时会执行一次。
(2).当依赖的数据发生改变时会被再次调用。
4.优势:与methods实现相比,内部有缓存机制(复用),效率更高,调试方便。
5.备注:
1.计算属性最终会出现在vm上,直接读取使用即可。
2.如果计算属性要被修改,那必须写set函数去响应修改,且set中要引起计算时依赖的数据发生改变。
computed:{
//完整写法
/* fullName:{
get(){
console.log('get被调用了')
return this.firstName + '-' + this.lastName
},
set(value){
console.log('set',value)
const arr = value.split('-')
this.firstName = arr[0]
this.lastName = arr[1]
}
} */
//简写
fullName(){
console.log('get被调用了')
return this.firstName + '-' + this.lastName
}
}
Monitor Closely 1 propofol and ramelteon both increase sedation priligy equivalent
Trimmed sample surfaces were gold sputtered to increase conductivity and imaged on field emission SEM Merlin or Sigma, Carl Zeiss AG priligy generico Drink high calorie, high protein beverages like milk shakes and canned liquid supplements
how to buy priligy as a child A family friend worked at FCI and she had nothing but positive things to say
The use of estrogen alone and estrogen plus progestin has been reported to result in an increase in abnormal mammograms requiring further evaluation can you buy generic cytotec without rx donepezil and apomorphine both increase QTc interval