【发布时间】:2021-05-09 02:50:56
【问题描述】:
我需要你的帮助,因为我正在尝试在已在类范围内声明的变量中对 javascript 对象进行解构赋值...即,我需要使用 {this.property, ... }
({ this.baseINSS,
this.baseIRPF,
this.discountINSS,
this.dependentesDiscount,
this.discountIRPF,
this.netSalary } = calculateSalaryFrom(element.target.value, Number(dependentes)));
上面提到的函数calculateSalaryFrom()会返回
{baseINSS: "9876",
baseIRPF: 9162.9,
dependentesDiscount: 0,
discountINSS: 713.1,
discountIRPF: 1650.44,
netSalary: 7512.459999999999,
percentageDependentes: "0.00",
percentageINSS: "7.22",
percentageIRPF: "16.71",
percentageSalary: "76.07"}
我收到了error TS1005: ':' expected.({ this.baseINSS,...
顺便说一句,我正在使用 angular 和 typescript
【问题讨论】:
标签: javascript class object this destructuring