mirror of
https://gitee.com/dromara/go-view.git
synced 2024-12-03 04:08:46 +08:00
commit
b7f84dbb0d
@ -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()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user