比如要有如下數(shù)組
data() {
return {
certificateData: [
{
name: 'xxx',
type: '環(huán)境證書',
imgs:[{url: 'xxxx.png']
},
{
name: 'yyy',
type: '安全證書',
imgs:[{url: 'yyy.png'}]
}
]
}
如果屬性已經(jīng)存在
修改對(duì)象中 imgs屬性
/// index為索引
this.certificateData[index].imgs = [url: 'osodo.png'];
如果屬性不存在
this.$set(this.certificateData, index, {
...this.certificateData[index],
buff: 'bits'
})