vue +echarts 实现乡镇地图

一、导入地图数据(我这里用的是json)
在这里插入代码片
``
<template>
<div class="content">
<!-- 地图 -->
<div id="map" style="width:1000px;height: 700px; position: relative"></div>
</div>
</template>
<script>
import echarts from "echarts"
import tuanfengJson from "./map.json"
export default {
components:{
},
data() {
return {
mapJson: [],
collapsable: false,
expandAll: true,
style: {
background: '#fff',
color: '#5e6d82',
},
}
},
async created() {
this.mapJson = await tuanfengJson;
this.mapData = tuanfengJson.features.map(item => {
return ({
name: item.properties.name,
value: 1000,
})
})
this.init() //调用下面的 echarts初始化
},
mounted() {
const data ={
town_name:'团风县'
}
this.getTowninfo(data)
},
methods: {
init() {
const that = this;
var myChart = echarts.init(document.getElementById('map'));
echarts.registerMap('cityMap', this.mapJson

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



