javascript - How to locate errors in vue esm.js
黄舟
黄舟 2017-05-24 11:38:48
0
1
1246


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?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
过去多啦不再A梦

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){

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template