starting at object with constructor ‘Watcher‘ | property ‘vm‘ -> object with constructor ‘Vu

使用了Vue 2.7,之前我是用 getCurrentInstance 然后直接获取的store 下面的 userId,后面加了一个 computed 。我以为computed 是和之前一样的就没改接口请求,然后就报错,其实 computed 返回的参数和 ref 是一样的需要 .value。

心得总结:

当出现 Converting circular structure to JSON
–> starting at object with constructor ‘Watcher’
| property ‘vm’ -> object with constructor ‘VueComponent’
| property ‘_scope’ -> object with constructor ‘EffectScope’
| property ‘effects’ -> object with constructor ‘Array’
— index 0 closes the circle
有 vm 、_scope、effects、Watcher 发生错误可能就是 Vue2.7 和 Vue3 ref 之类的需要 .value才能拿到真实的值。

总结

当请求接口出生出错:
1: 先查看参数是否正确。
2: 查看 axios 的 request 的值。
3: 如果 network 没有请求接口 大部分应该在 请求参数的时候就错误了。

猜你喜欢

转载自blog.csdn.net/supitll/article/details/129633141