zl程序教程

您现在的位置是:首页 >  前端

当前栏目

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

Vueecharts 报错 of Cannot 整合 Read init
2023-06-13 09:17:14 时间

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

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

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

这是错误的写法 正确的是 

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