vue-echarts踩坑
echarts的引入
echarts5.0.0以前版本引入方式
import echarts from 'echarts'
echarts5.0.0以后如果还用以前的引入方式会报错"export ‘default’ (imported as ‘echarts’) was not found in ‘echarts’,需要换种引用
import * as echarts from 'echarts'
在main.js里全局引用
import Vue from 'vue';
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts;
也可以在页面单独引用需要的图表
import VueECharts from 'vue-echarts';
import 'echarts/lib/chart/bar';
import 'echarts/lib/component/tooltip';
在echarts5.0.0下使用vue-echarts,如果全局引用,会报错,单独引用的话就没有问题。还没有找到解决办法