示例对象:
this.advData = {
'title': this.addAdvS2.value.title ,
'breadcrumb': this.suggestData.breadcrumb,
'price': this.addAdvS2.value.price,
'status': this.addAdvS2.value.status,
'province': this.addAdvS2.value.province,
'city': this.addAdvS2.value.city,
'images': this.addAdvS2.value.images
};
我想将此项添加到“advData”对象:
{'id': this.suggestData.id}
我可以这样做,而不将对象转换为数组吗?
答案 0 :(得分:1)
只需使用密钥添加它:
this.advData['id'] = this.suggestData.id