场景:已经定义好了传参,在调接口前相对这个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)

Logo

前往低代码交流专区

更多推荐