我正在学习在我的项目中使用echarts.js。
我想知道如何使用扩展echarts-gl (用于3D图形)与ES模块。文档非常简洁,我只是个菜鸟。
事实上,我正在尝试将echarts-gl与echarts-for-vue结合使用,有人尝试过吗?
我的main.js看起来像这样:
import Vue from 'vue';
import App from './App.vue';
import { plugin } from 'echarts-for-vue';
import * as echarts from 'echarts/esm/echarts';
import 'echarts/esm/chart/line';
import 'echarts/esm/chart/bar';
import 'echarts/esm/component/title';
import 'echarts/esm/component/tooltip';
import 'echarts/esm/component/legend';
import 'echarts/esm/component/toolbox';
import 'echarts/esm/component/polar';
import 'echarts/esm/component/visualMap';
// require('echarts-gl/lib/echarts-gl');
// import '../assets/echarts-gl.js';
// import 'echarts-gl/lib/component/grid3D';
// import 'echarts-gl/lib/chart/surface';
Vue.config.productionTip = false;
Vue.use(plugin, { echarts });
new Vue({
render: (h) => h(App),
}).$mount('#app');我不知道在哪里或如何包含echarts-gl的导入。需要配置webpack吗?很抱歉我缺乏专业知识。
谢谢!
发布于 2021-01-20 17:24:13
对于我来说,当我像这样导入它时,它是有效的:
import 'echarts';
import 'echarts-gl';还要确保使用与echarts兼容的echarts-gl版本。
(
"echarts": "4.9.0",
"echarts-gl": "1.1.2",
"vue-echarts": "4.1.0",
)https://stackoverflow.com/questions/65616894
复制相似问题