How to omit the DataCloneError: The object could not be cloned. using Angular NavigationExtras state?

How to omit the DataCloneError: The object could not be cloned. using Angular NavigationExtras state?

我在我的应用程序的 2 个地方使用 Angular NavigationExtras 状态的功能,但导致具有以下状态的相同 url 'activites/:name'。大多数字段是 objects/array 个对象。

问题是该方法仅在一页中有效,我正在以相同的状态使用它,我可以以某种方式省略 cannot be cloned 错误吗?

goToActivity(action, data, report, preview) {
    let pageUrl = action.toLowerCase();
    let navigationExtras: NavigationExtras = {
      state: {
        date: this.reportDate,
        href: this.getCurrentUrlWithoutTabs(this.router.url),
        report: data,
        editMode: true,
        reportData: report,
        previewMode: preview
   }
 };
 this.router.navigate([`/tabs/activities/${pageUrl}`], navigationExtras);
}

这不是总能奏效的解决方案,但如果需要使用相同的路由相关功能,将其分离到组件中可能是个好主意,可以在许多 Ionic Pages 中使用。通过使用该组件,问题消失了。