报错原因

执行JSON.stringify(obj)时 检测到obj 对象有递归引用 (对象的属性值引用了自身)

// 问题代码 -- 注意这里有互相引用的问题
this.param = this.contract[this.index]
this.param.list = this.contract

解决方法

赋值时使用 JSON.parse(JSON.stringify()) 来切断数据之间的相互引用

// 修改后的代码
this.param = JSON.parse(JSON.stringify(this.contract[this.index]))
this.param.list = JSON.parse(JSON.stringify(this.contract))

相关文章:

  • 2021-07-09
  • 2022-12-23
  • 2022-01-13
  • 2021-11-01
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2021-05-04
猜你喜欢
  • 2021-11-06
  • 2021-10-28
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案