语法:Vue.set(obj,key,value);
obj: {
active: false
};
Vue.set(this.obj,"active",true);
语法:Vue.set(list,index,value);
list: [0,1,2,3];
Vue.set(this.list,0,10);
语法:Vue.set(list,index,{...list,key:value});
list: [{
id: 0,
active: false
}, {
id: 1,
active: false
}];
Vue.set(this.list,0,{ ...list[0], active: true });
语法:this.$set(obj,key,value);
obj: {
active: false
};
this.$set(this.obj,"active",true);
语法:this.$set(list,index,value);
list: [0,1,2,3];
this.$set(this.list,0,10);
语法:this.$set(list,index,{...list,key:value});
list: [{
id: 0,
active: false
}, {
id: 1,
active: false
}];
this.$set(this.list,0,{ ...list[0], active: true });