[Vue warn]: Error in nextTick: "TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Vue'
| property '$options' -> object with constructor 'Object'
| property 'router' -> object with constructor 'VueRouter'
--- property 'app' closes the circle"
内容翻译
一般报错
TypeError: Converting circular structure to JSON
是因为存在循环引用,并且使用JSON.stringify
方法去转化成字符串
案例
// 问题代码
const x = { a: 8 };
const b = { x };
b.y = b; // 循环引用
JSON.stringify(b); // 触发报错
// 解决问题代码
const x = { a: