vue中如何给object对象添加值
场景:已经定义好了传参,在调接口前相对这个object进行修改editForm: {"nickName": null,"salary": null,"marryState": null,"birthday": "","liveWhiteMember": null,"islovers": null,"password": '',"re
·
场景:已经定义好了传参,在调接口前相对这个object进行修改
editForm: {
"nickName": null,
"salary": null,
"marryState": null,
"birthday": "",
"liveWhiteMember": null,
"islovers": null,
"password": '',
"restrictionType": null,
"grade": null
}
TestAccount() {
let param = Object.assign({}, this.editForm)
this.$set(param, 'editType', 2)//$set()方法给param添加属性
if (this.productType === 1) {
delete param.grade
this.editTestAccountF(param)
} else if (this.productType === 2) {
delete param.salary
this.editAutoTestAccountS(param)
$set(obj, ‘key’, vaule)
更多推荐
已为社区贡献4条内容
所有评论(0)