Vue整合Echarts报错:“TypeError: Cannot read properties of undefined (reading ‘init‘)“

简介: Vue整合Echarts报错:“TypeError: Cannot read properties of undefined (reading ‘init‘)“

 Vue整合完Echart使用的时候报错:"TypeError: Cannot read properties of undefined (reading 'init')" 大概意思是无法读取未定义的属性(init)


64c9dd5a23b34b7894ec7c7e7352eecf.png

  在网上引用echarts的写法是在main.js 引入这两行

1. // 引入echarts
2. import echarts from 'echarts'
3. Vue.prototype.$echarts = echarts


278253a05a68470db9467814c0b7bd4d.png


这是错误的写法 正确的是

1. import * as echarts from 'echarts'
2. Vue.prototype.$echarts = echarts


b3547306a8b2451793ab5f00c6afa8b6.png

b7e744015bd342a5be2d6ceece0fa409.png


相关文章
|
JavaScript
Vue+element_Table树形数据与懒加载报错Error in render: “RangeError: Maximum call stack size exceeded“
本文讨论了在使用Vue和Element UI实现树形数据和懒加载时遇到的“Maximum call stack size exceeded”错误,指出问题的原因通常是因为数据中的唯一标识符`id`不唯一,导致递归渲染造成调用栈溢出。
826 1
Vue+element_Table树形数据与懒加载报错Error in render: “RangeError: Maximum call stack size exceeded“
|
存储 JavaScript 前端开发
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
|
人工智能 JavaScript 索引
Duplicate keys detected: This may cause an update error.【Vue遍历渲染报错的解决】
这篇文章讨论了在Vue中进行列表渲染时遇到的“Duplicate keys detected”错误。这个错误通常发生在使用 `v-for` 指令渲染列表时,如果没有为每个循环项指定一个唯一的 `key` 属性,或者指定的 `key` 属性值重复了。文章提供了导致错误的原始代码示例,并给出了修正后的代码,通过在 `key` 绑定中加入索引确保 `key` 的唯一性。此外,文章还解释了为什么需要唯一 `key` 以及如何解决这个问题。
Duplicate keys detected: This may cause an update error.【Vue遍历渲染报错的解决】
|
12月前
|
JavaScript
Vue启动时报错的解决方案,以及解决相同路径跳转报错的问题
Vue启动时报错的解决方案,以及解决相同路径跳转报错的问题
838 0
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
215 0
|
JavaScript
VUE——uuid引入报错
VUE——uuid引入报错
283 0
|
JavaScript
Vue——报错总结
Vue——报错总结
109 0
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
|
12月前
|
小程序 前端开发 JavaScript
微信小程序图表制作利器:ECharts组件的使用与技巧
微信小程序图表制作利器:ECharts组件的使用与技巧
1010 1