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

yundejia

关注

阅读 154

2022-10-23


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

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

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

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

 

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

这是错误的写法 正确的是 

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

 

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

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

精彩评论(0)

0 0 举报