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

我的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.

而且影响了router的传值。

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

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

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

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

猜你喜欢

转载自blog.csdn.net/qq_22059611/article/details/85158428