使用 echarts 时遇到浏览器错误:Map xxx not exists. The GeoJSON of the map must be provided.
遇到这个错误,首先检查一下 geo 中的 map 参数配置,是否跟引入的地图名称一致。
this.$echarts.registerMap('china', geoJson.data.data)
geo: {
//使用 registerMap 注册的地图名称。
map: 'china',
label: {
show:false
},
aspectScale:0.5,
top:'10%',
roam: false,
itemStyle: {
areaColor: '#00196d',
borderColor: '#1773c3',
shadowColor: '#1773c3',
shadowBlur: 20
}
},
如果检查一致,请使用低版本的 echarts。
npm install echarts@4.1.0 --save