中国地图隐藏南海诸岛功能
在geo选项中添加regions属性,代码如下
const option = {
.......
geo: {
map: 'china',
show: true,
roam: true,
zoom: this.centerObj.layoutSize,
center: this.centerObj.center,
select: {
itemStyle: {
color: this.clickcolor, // 设置地图点击后的颜色
areaColor: this.clickcolor
}
},
label: {
normal: {
show: true,
color: '#999',
fontSize: '12'
},
emphasis: {
show: true,
color: '#999',
fontSize: '12'
}
},
itemStyle: {
normal: {
areaColor: '#fff',
borderColor: '#c5c5c5'
// borderColor: 'red'
},
emphasis: {
areaColor: '#EFF1FF' // 悬浮区背景
}
},
regions: [
{ // 隐藏南海诸岛
name: '南海诸岛',
itemStyle: {
// 隐藏地图
normal: {
opacity: 0 // 为 0 时不绘制该图形
}
},
label: {
show: false // 隐藏文字
}
}
]
.......
},