Use vconsole in vue when switching routes is wrong, ask for help

introduce

into vue main.js

 import VConsole from "vconsole"
let option ={
  maxLogNumber:1000
}
var VConsole = new Vconsole(option);
The

component displays normally and can be used normally, but each time you switch routes, you will get an error
main.js [Vue warn]: 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.


if complex objects are printed somewhere, try commenting out console in the code.


after using vconsole , this problem occurs if complex objects are printed, such as the following:

  

you read the wrong message yourself. [ Property or method "toJSON" is not defined on the instance ] indicates that there must be a place where toJSON is illegally referenced when switching routes.
since you have referenced the vconsole, component in main.js and can be used properly, it means there is nothing wrong with your reference. You should go to your code to find problems

Menu