uniapp引入echarts报错Uncaught (in promise) TypeError: Cannot read properties of null (reading 'getAttribute')
时间: 2023-10-19 15:29:12 浏览: 190
根据您提供的引用内容,uniapp引入echarts报错Uncaught (in promise) TypeError: Cannot read properties of null (reading 'getAttribute')是因为在初始化echarts时,获取不到对应的属性名。这可能是因为在created钩子函数中初始化echarts时,DOM元素还没有生成,导致找不到对应的id而报错。解决方法是将echarts的初始化放在mounted钩子函数中进行。这样可以确保在DOM生成后再进行echarts的初始化,避免了报错。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [在vue中引入echarts ,应用报错, “TypeError: Cannot read properties of undefined (reading ‘init‘)](https://blog.csdn.net/mzy110_/article/details/123179043)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#Object‘的...](https://download.csdn.net/download/weixin_38640984/13612199)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [echarts报错 TypeError: Cannot read properties of null (reading ‘getAttribute‘):](https://blog.csdn.net/weixin_53791978/article/details/126506879)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文