!71 地图南海群岛bug

Merge pull request !71 from daidai/dev
This commit is contained in:
奔跑的面条 2022-10-08 09:46:13 +00:00 committed by Gitee
commit b7f84dbb0d

View File

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