Vue错误——Property or method "toJSON" is not defined on the instance but referenced during render.

以你之姓@ 2022-04-03 08:16 1946阅读 0赞

我的vue在注册过程中报了这个错误:

Property or method “toJSON” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

20181221104931116.png

而且影响了router的传值。

很奇怪的是引起这个问题的原因在于,在于在生命周期的created方法中报错:

created() {
console.log(‘created’);
console.log(this);
// console.log(‘params:’ + JSON.stringify(this.$route.params));
},

一旦去掉console.log(this)就能解决这个问题

为什么会出现这个问题?后续研究研究

发表评论

表情:
评论列表 (有 0 条评论,1946人围观)

还没有评论,来说两句吧...

相关阅读