Problems encountered:
When using the SVGA icon in a Vue project, I encountered Canvas Canvas <; cannot read property "getContext" of null.> Such an error, it is finally known that the page load order caused the problem. Solution: In a normal HTML page, a js method can be placed either in the head or before the end of the body tag, but there are some differences. When in the head tag, it is usually just loaded and not automatically executed immediately. It will only be executed after being triggered. Therefore, when the script tag is in this location, variables in JavaScript are not initialized, so the above error may occur; Before the end of the body tag, the JavaScript is loaded and executed immediately. This time, however, the problem was that the method was called before the page had finished loading. Solution: Based on the above analysis, there are two ways to solve this problem in normal HTML: Put the script tag directly after the end of the body tag. When the script tag is in the head tag, you can automatically fire this event by introducing something like window.onload. This time, the answer is to let the page load completely before calling the method.
When using the SVGA icon in a Vue project, I encountered Canvas Canvas <; cannot read property "getContext" of null.> Such an error, it is finally known that the page load order caused the problem. Solution: In a normal HTML page, a js method can be placed either in the head or before the end of the body tag, but there are some differences. When in the head tag, it is usually just loaded and not automatically executed immediately. It will only be executed after being triggered. Therefore, when the script tag is in this location, variables in JavaScript are not initialized, so the above error may occur; Before the end of the body tag, the JavaScript is loaded and executed immediately. This time, however, the problem was that the method was called before the page had finished loading. Solution: Based on the above analysis, there are two ways to solve this problem in normal HTML: Put the script tag directly after the end of the body tag. When the script tag is in the head tag, you can automatically fire this event by introducing something like window.onload. This time, the answer is to let the page load completely before calling the method.
Read More:
- SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
- Error in loading online pictures on billboard in cesium tainted canvas may not be loaded
- Open the Cocos creator editor and report an error property UUID of null
- When writing a website, Vue + Flash prompts network error when visiting Vue page
- Uncaught typeerror: cannot set property ‘of null error resolution
- Has HTML webpack plugin been installed, or error: cannot find module ‘HTML webpack plugin’
- When the permission question mark appears in the sshfs mount, or input / output error occurs
- Solution of node canvas error reporting in MacOS M1 installation
- [Vue warn]: Error in nextTick: “TypeError: Cannot read property ‘map‘ of null“
- ERROR: Adobe Flashplayer or HTML5 Browser with WebGL or CSS3D support requ
- nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property
- Solution to the problem that some special characters in finereport cannot be displayed or displayed as question mark
- The template tags of all vscode Vue files report errors in red~
- Uncaught TypeError: Cannot read property ‘replace’ of null
- Failed to download when creating Vue project, solution
- Question: connecting git team provider failed. See log for details
- Vue error resolution: TypeError: Cannot read property’_t’ of undefined”
- Vue error resolution: typeerror: cannot read property ‘_ t’ of undefined”
- Error creating project by Vue yorkie: command failed
- Android avoids memory leak: reasonable use of getcontext() and getapplication ()