在后台请求过来的数据res,在赋值给变量之前加上属性,之后再赋值给变量,打印出来的结果是有对应的get和set方法
res.forEach((item)=>{
item.num = 4
})
console.log(res)
this.topicList = res
for(var i =0;i<this.topicList.length;i++){
this.topicList[i].num = 4
}
console.log(this.topicList)
第一种就有对应的get和set方法,第二种是没有的