jsInitialize failed: invalid dom.
时间: 2023-09-26 09:10:32 浏览: 119
问题中提到的错误 "Initialize failed: invalid dom" 是由于在eCharts初始化时使用了错误的DOM元素引用造成的。根据引用中的解决办法,正确的做法是使用原生方法获取DOM元素。可以通过使用`document.getElementById('mychart')`来获取正确的DOM元素引用。中所提到的,当切换页面时,DOM元素可能会被销毁,因此需要检查DOM元素是否存在。如果DOM元素存在,则进行图表的初始化和渲染。否则,可以跳过该步骤以避免错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [vue使用echarts报错:Error: Initialize failed: invalid dom.](https://blog.csdn.net/m0_71645665/article/details/130805086)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Uncaught (in promise) Error: Initialize failed: invalid dom.](https://blog.csdn.net/m0_53808238/article/details/130230518)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文