Error in mounted hook: "TypeError: Cannot read property 'init' of undefined"

1.安装echarts依赖

  npm install echarts --save-dev

2.main.js中全局引用

  import echarts from ‘echarts‘
  Vue.prototype.$echarts = echarts 

3.运行中报错

  Error in mounted hook: "TypeError: Cannot read property 'init' of undefined"

4.解决办法

  将 main.js中的引用 import echarts from ‘echarts‘ 改为 import * as echarts from ‘echarts‘

5.测试

  Error in mounted hook: "TypeError: Cannot read property 'init' of undefined"

 

 6.效果

  Error in mounted hook: "TypeError: Cannot read property 'init' of undefined"

 

 

 


Error in mounted hook: "TypeError: Cannot read property 'init' of undefined"

 

Error in mounted hook: "TypeError: Cannot read property 'init' of undefined"

上一篇:WCF编程系列(三)地址与绑定


下一篇:刚发布的Chrome插件-用来阻止你摸鱼,节省你的时间,提高你的工作和学习效率