问题描述:项目中需要向后台传字符串,所以需要将对象转化,
但使用JSON.stringify(data)转化时出现了对象存在循环引用的bug,且无法找到是哪里拷贝有问题。

这里使用插件CircularJSON 忽略循环引用强制转化

// 安装
npm install -S circular-json    
// 引用:
import CircularJSON from 'circular-json'
// 转化:
let data= CircularJSON.stringify(data)
let data= CircularJSON.parse(data)

更多推荐

‘Converting circular structure to JSON‘报错的解决方案