vue中同时引入echarts5和echarts4

前言: 在已有项目上进行二次开发, 遇到了环形图,有渐变,圆角;圆角的属性需要echarts5才支持; 所以需要同时引入echarts5。

一、效果:

二、具体步骤

1、安装

npm install echarts5@npm:echarts@5

2、引入

在main.js中

import * as Echarts5 from 'echarts5'
Vue.prototype.$echarts5 = Echarts5;

3、使用

组件文件中

this.myChart = this.$echarts5.init(document.getElementById(this.chartId))
this.myChart.setOption(this.options)

就搞定了,其他地方配置和echarts4一样就行。

猜你喜欢

转载自blog.csdn.net/weixin_40856652/article/details/125482331