vue 中 使用多个版本 echarts
由于是老项目echarts版本太低,不符合设计要求,于是我想升级下echarts版本,可是这样又会导致原有的功能不兼容,于是我想到同时安装多个版本的echarts
首先安装最新版本的echarts
npm install echarts5@npm:echarts@5
执行完之后,同时在node_modules文件中能找到一个echarts5的文件
然后在mian.js中引入并添加prototype
import * as Echarts5 from 'echarts5'
Vue.prototype.$echarts5 = Echarts5
使用
let myChart = this.$echarts5.init(document.getElementById(id))
let option = {}
myChart.setOption(option)