TypeError: Cannot read property 'code' of null vue.esm.js?b010:523
Many errors are like this, how to locate the specific one? Where is the location?
过去多啦不再A梦2017-05-24 11:40:48
Click on this error message and you will see blue detailed information
In addition, you should be able to find the code corresponding to this error by checking the .code in your code, and then see under what circumstances the things in front of the .code are initialized. Is it possible to use it before it is initialized? (The code attribute accessing the object in the rendering page, watcher, calculated property, hook... are all called "use")
Solution (applicable to all technical frameworks and libraries, not just Vue), test the object before using any possible properties of uninitialized objects, like this:
let myCode = myObject && myObject.code
if (myObject && myObject.code === 200){