效果图:
事前配置
我只在main.js中引入了echarts
上面两个问题解决办法: 可直接使用new this.$echarts
写渐变柱状图解决方案
1.直接使用new echarts报错,
原因: 我只在main.js中引入了echarts,在该页面未引入echarts
解决方案:在该页面引入echarts
(这种是我百度到的方法,但并未解决我的问题,如果这种不可以可使用new this.$echarts)
import echarts from 'echarts'
2.使用this.$ echarts出现效果覆盖
原因:但当有多个柱状图时会出现效果覆盖
解决方案:使用new this.$echarts即可