報錯提示:
1.試了在main.js里寫:
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
然后組件內(nèi)引用
this.$echarts.init(document.getElementById('idname'));
無用-------------
2. 又試了只在組件內(nèi)引用
import echarts from 'echarts'
echarts.init(document.getElementById('idname'));
無用-------------
3. 在init之前檢查了document.getElementById('idname')?并不是null,是確實存在的對象
4. 最后main.js也不用了亿扁,import 也不用了湃鹊,直接require
let echarts = require('echarts');
let myChart = echarts.init(document.getElementById('myPancake'));