This commit is contained in:
13713575202 2025-04-24 15:22:03 +08:00
parent 7737c228ec
commit 0481e0225a

View File

@ -165,8 +165,8 @@ export const useEcharts = (elRef, theme = 'default') => {
clear && chartInstance?.clear();
chartInstance?.setOption(unref(getOptions));
chartInstance.off('click'); // [!code ++]
chartInstance.on('click', handleMapClick); // [!code ++]
chartInstance.off('click');
chartInstance.on('click', handleMapClick);
}, 30);
});
}
@ -188,7 +188,19 @@ export const useEcharts = (elRef, theme = 'default') => {
console.info('getMap', echarts.getMap(mapName));
if (!echarts.getMap(mapName)) {
echarts.registerMap(mapName, geoJSON);
echarts.registerMap(mapName, geoJSON, { override: true });
nextTick(() => {
if (chartInstance && cacheOptions.value.geo?.map === mapName) {
chartInstance.setOption(
{
geo: { map: mapName },
geo3D: { map: mapName },
},
true
);
}
});
}
}