echarts Cannot read properties of undefined (reading 'init')
时间: 2023-09-29 11:02:33 浏览: 129
jstree报错 Cannot read property ‘state’ of undefined
你在使用echarts时遇到了报错"Cannot read properties of undefined (reading 'init')"。根据引用,这个错误通常是由于未正确引入echarts库导致的。
根据引用和,正确引用echarts库的方式是在main.js文件中使用import语句引入echarts,并将其挂载到Vue实例的原型上。你可以尝试将引用方式修改为以下形式:
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts
这样做可以确保正确引入echarts库并将其挂载到Vue实例上,从而解决报错问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [echart报错Cannot read properties of undefined (reading ‘type‘)](https://blog.csdn.net/weixin_52691965/article/details/123529169)[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_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [vue中用echarts 报Cannot read properties of undefined (reading ‘init‘)](https://blog.csdn.net/j244233138/article/details/130406485)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文