引入echarts时报错 “TypeError: Cannot read properties of undefined (reading ‘init‘)“的解决方案

简介: 引入echarts时报错 “TypeError: Cannot read properties of undefined (reading ‘init‘)“的解决方案

“灵异事件!程序里发现了新Bug但是它正常运行啦!”、“谁敢信,我电脑死机竟然是因为放青藏高原的时候硬盘共振振幅太大了——”……

人生处处有Bug


在用vue ui 创建项目,引入Echarts图表的时候,终端报了'Error in mounted hook: "TypeError: Cannot read properties of undefined (reading 'init') " '的错误,翻译为:“挂载的钩子中出现错误:“TypeError:无法读取未定义的属性(读取'init')”



用import * as echarts from 'echarts'  替换  import echarts from 'echarts',便可以有效解决


相关文章
|
4月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
110 0
|
4月前
|
JavaScript
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
91 0
|
4月前
|
前端开发 JavaScript
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
103 0
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
Cannot read properties of undefined (reading ‘row‘)
Cannot read properties of undefined (reading ‘row‘)
Cannot read properties of undefined (reading ‘post‘)
Cannot read properties of undefined (reading ‘post‘)
|
5月前
|
JavaScript
element-ui Cannot read properties of undefined (reading ‘name‘),data中写成集合的形式
element-ui Cannot read properties of undefined (reading ‘name‘),data中写成集合的形式
|
5月前
|
JavaScript
Cannot read properties of undefined (reading ‘$router‘)
Cannot read properties of undefined (reading ‘$router‘)
Cannot read properties of undefined (reading ‘username‘),粗心惹的祸,数据都不知道写呢了,
Cannot read properties of undefined (reading ‘username‘),粗心惹的祸,数据都不知道写呢了,
|
6月前
|
前端开发 小程序 JavaScript
微信小程序-Unhandled promise rejection TypeError: Cannot read property ‘get‘ of undefined
微信小程序-Unhandled promise rejection TypeError: Cannot read property ‘get‘ of undefined