fix: 解决地图编辑不显示南海群岛 预览时仍显示

This commit is contained in:
刘嘉威 2022-10-08 14:52:56 +08:00
parent 3e8329c31f
commit 17f1a7ce9d

View File

@ -61,10 +61,14 @@ const getGeojson = (regionId: string) => {
//
registerMap(props.chartConfig.option.mapRegion.adcode, { geoJSON: {} as any, specialAreas: {} })
//
// china
const registerMapInitAsync = async () => {
await nextTick()
await getGeojson(props.chartConfig.option.mapRegion.adcode)
if (props.chartConfig.option.mapRegion.adcode!="china") {
await getGeojson(props.chartConfig.option.mapRegion.adcode)
}else{
await hainanLandsHandle(props.chartConfig.option.mapRegion.showHainanIsLands)
}
vEchartsSetOption()
}
registerMapInitAsync()
@ -85,7 +89,14 @@ const dataSetHandle = async (dataset: any) => {
isPreview() && vEchartsSetOption()
}
//
const hainanLandsHandle=async(newData:boolean)=>{
if (newData) {
await getGeojson('china')
} else {
registerMap('china', { geoJSON: mapJsonWithoutHainanIsLands as any, specialAreas: {} })
}
}
// dataset
watch(
() => props.chartConfig.option.dataset,
@ -102,11 +113,7 @@ watch(
watch(
() => props.chartConfig.option.mapRegion.showHainanIsLands,
async newData => {
if (newData) {
await getGeojson('china')
} else {
registerMap('china', { geoJSON: mapJsonWithoutHainanIsLands as any, specialAreas: {} })
}
await hainanLandsHandle(newData)
vEchartsSetOption()
},
{