From 0481e0225a24ef49893121ae23c4b7c4dc835d48 Mon Sep 17 00:00:00 2001 From: 13713575202 <1345916905@qq.com> Date: Thu, 24 Apr 2025 15:22:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useEcharts.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/hooks/useEcharts.js b/src/hooks/useEcharts.js index 24fd01b..348b635 100644 --- a/src/hooks/useEcharts.js +++ b/src/hooks/useEcharts.js @@ -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 + ); + } + }); } }