具体实现
安装echarts
在终端下安装echarts
npm install -D echarts
安装echarts-gl
在终端下安装echarts-gl
npm install -D echarts-gl
earth3D组件
earth3D.vue
<template>
<div class="globe3d-earth-container" >
<div class="globe3d-earth" ref="Globe3d"></div>
</div>
</template>
<script>
import Vue from "vue";
import echarts from "echarts";
import "echarts-gl";
import option from './Globe3d.js'
import { debounce } from "./debounce.js";
Vue.prototype.echarts = echarts;
export default {
name: "earth3D",
data() {
return {
myChart: null,
resizeHandler: null
}
},
mounted() {
// 基于准备好的dom,初始化echarts实例
this.myChart = echarts.init(this.$refs.Globe3d);
// 使用刚指定的配置项和数据显示图表。可视化3D
this.myChart.setOption(option);
this.resizeHandler = debounce(() => {