最终效果:

1、下载echarts,进行引入
以第一个为例,打开链接,选择省市,对数据进行下载

3、页面具体代码
<template>
<div ref="charts" class="echarts"></div>
</template>
<script>
import * as echarts from "echarts";
import Hebei from "./Hebei.json";
export default {
mounted() {
this.$nextTick(() => {
this.initCharts();
});
},
methods: {
initCharts() {
const charts = echarts.init(this.$refs["charts"]);
const option = {
backgroundColor: "#020933",
// 提示浮窗样式
tooltip: {
show: false,
trigger: "item",
backgroundColor: "#0C121C",
borderColor: "rgba(0, 0, 0, 0.16);",
hideDelay: 100,
triggerOn: "mousemove",
enterable: true,
textStyle: {
color: "#DADADA",
fontSize: "12",
width: 20,
height: 30,
overflow: "break",
},
showDelay: 100,
},
// 地图配置
geo: {
map: "mapTest",
zoom: 1.2,
label: {
normal: {
show: true,
textStyle: {
color: "#fff",
},
},
emphasis: {
textStyle: {
color: "#fff",
},
},
},
itemStyle: {
normal: {
borderColor: "#2ab8ff",
borderWidth: 1.5,
areaColor: "#12235c",
},
emphasis: {
areaColor: "#2ab8ff",
borderWidth: 0,
},
},
},
};
//注意,第一个参数的名字必须和option.geo.map一致
echarts.registerMap("mapTest", Hebei);
charts.setOption(option);
},
},
};
</script>
<style scoped>
.echarts{
width: 1032px;
height: 846px;
}
</style>