【发布时间】:2021-02-02 07:43:54
【问题描述】:
我遇到错误
TypeError: 无法添加属性 newField,对象不可扩展
虽然添加任何新键或更改任何值都没有发生,但不知道出了什么问题。
dynamicFilter;
public ionViewWillEnter() {
this.commonservice.showLoading();
this.store.dispatch(activeBookingActions.getBookingFiltersRequest());
this.bookingFilterSubscription = this.store.pipe(select(selectActiveBookingData)).subscribe(response => {
this.commonservice.hideLoading();
if (response.bookingdata && response.bookingdata.filterlist && response.bookingdata.filterlist.data && (response.bookingdata.filterlist.data.action === 'bookingFilters')) {
this.commonservice.hideLoading();
this.filterList = response.bookingdata.filterlist.data.list;
this.sortingList = this.filterList.sorting;
this.dynamicFilter = [...this.filterList.filter];
console.log(this.dynamicFilter);
this.dynamicFilter.forEach((x) => {
if (x.design_type == 'checkbox') {
x.design_type = 'sadas'; // this line giving error
}
});
}
});
}
试过
https://stackoverflow.com/a/49022130/12917651
没有运气。
【问题讨论】:
标签: angular typescript