Open Vitaminaq opened 2 years ago
// 简化了set get的写法
let obj = {
get num(){
return (this._num?this._num:0)+'%';
},
set num(val){
if(typeof val === 'number'){
return this._num = val;
}
throw Error('please input number');
}
}