diff --git a/src/components/custom-echart-maps/index.vue b/src/components/custom-echart-maps/index.vue index f370744..0725c9f 100644 --- a/src/components/custom-echart-maps/index.vue +++ b/src/components/custom-echart-maps/index.vue @@ -1,5 +1,5 @@ diff --git a/src/hooks/useEcharts.js b/src/hooks/useEcharts.js index 348b635..6cf77b7 100644 --- a/src/hooks/useEcharts.js +++ b/src/hooks/useEcharts.js @@ -110,7 +110,6 @@ export const useEcharts = (elRef, theme = 'default') => { } function handleMapClick(params) { - console.info('handleMapClick', params); // 过滤非地图区域的点击事件 if (params.componentType === 'geo3D' || params.componentType === 'geo') { // 获取点击区域信息 @@ -163,8 +162,9 @@ export const useEcharts = (elRef, theme = 'default') => { if (!chartInstance) return; } clear && chartInstance?.clear(); - chartInstance?.setOption(unref(getOptions)); + + // 立即绑定事件 chartInstance.off('click'); chartInstance.on('click', handleMapClick); }, 30); @@ -189,18 +189,6 @@ export const useEcharts = (elRef, theme = 'default') => { console.info('getMap', echarts.getMap(mapName)); if (!echarts.getMap(mapName)) { echarts.registerMap(mapName, geoJSON, { override: true }); - - nextTick(() => { - if (chartInstance && cacheOptions.value.geo?.map === mapName) { - chartInstance.setOption( - { - geo: { map: mapName }, - geo3D: { map: mapName }, - }, - true - ); - } - }); } }