Error in created hook: "TypeError: Cannot read properties of undefined (reading 'show')"
时间: 2023-08-17 17:12:33 浏览: 142
Error in mounted hook: "ReferenceError: AMap is not defined" fo
5星 · 资源好评率100%
引用\[1\]:根据引用\[1\]中的描述,这个错误是因为在created钩子函数中初始化echarts时,dom还没有生成,导致找不到id而报错。解决方法是将echarts的初始化放在mounted钩子函数中进行。这样可以确保dom已经生成后再进行初始化操作。引用\[3\]中也提到了正确的引入echarts的方式,应该使用import * as echarts from "echarts",而不是import echarts from 'echarts'。这可能是导致错误的另一个原因。请检查你的代码,确保正确引入echarts并将初始化操作放在mounted钩子函数中。
#### 引用[.reference_title]
- *1* [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^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [webpack 打包错误](https://blog.csdn.net/qq_27009517/article/details/123376735)[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^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Error in mounted hook: “TypeError: Cannot read properties of undefined (reading ‘i](https://blog.csdn.net/qq_48203828/article/details/121046019)[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^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文