main.js 全局引入

import * as echarts from 'echarts'
import Vue from 'vue'


Vue.prototype.$echarts = echarts

使用:

this.myChart = echarts.init(document.getElementById('main'))

改为

this.myChart = this.$echarts.init(document.getElementById('main'))