Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

比如要有如下数组

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
data() {
return {
certificateData: [
{
name: 'xxx',
type: '环境证书',
imgs:[{url: 'xxxx.png']
},
{
name: 'yyy',
type: '安全证书',
imgs:[{url: 'yyy.png'}]
}
]
}

如果属性已经存在
修改对象中 imgs属性

1
2
/// index为索引
this.certificateData[index].imgs = [url: 'osodo.png'];

如果属性不存在

1
2
3
4
this.$set(this.certificateData, index, {
...this.certificateData[index],
buff: 'bits'
})

评论