我正在尝试使用history.push在组件之间导航。 导航状态与path一起传递。
在IE中,它在globalHistory.pushState期间给出DATACloneError
this.props.history.push({
pathname: `/apps/propertyDetails`,
search: '',
state: {
propertyID: this.state.propertyID,
invoiceId1: this.state.invoiceId,
}})
它可以在chrome中使用,但IE会提供DATACloneError
答案 0 :(得分:1)
请检查this article:
状态对象可以是任何可以序列化的对象。因为Firefox将状态对象保存到用户的磁盘上,以便用户重新启动浏览器后可以将其还原,所以我们对状态对象的序列化表示施加了640k个字符的大小限制。如果将序列化表示形式大于此形式的状态对象传递给pushState(),则该方法将引发异常。如果您需要更多空间,建议您使用sessionStorage和/或localStorage。
也许您传递的状态被序列化为大于640k。请检查参数值。此外,您可以尝试测试以下代码:
this.props.history.push({
pathname: `/apps/propertyDetails`,
search: '',
state: {
propertyID: "<test id>",
invoiceId1: "<test id>",
}})