使用echarts 报错[Vue warn]: Error in mounted hook: “TypeError: Cannot read property ‘init‘ of undefined“
出现以下问题是在mounted()中使用官方示例的时候报了以下错误:
Error in mounted hook: “TypeError: Cannot read property ‘init’ of undefined”
或 Cannot read property ‘init’ of undefined
解决方案:
放弃import,改用require的方式引入库
解决方案: 放弃import,改用require的方式引入库
这里是引用 import echarts from 'echarts //把这种引入方式改为下面的方式 let echarts = require('echarts')