From 61e562e66d045defe9225a88b85110fe7db0ca01 Mon Sep 17 00:00:00 2001 From: 13713575202 <1345916905@qq.com> Date: Fri, 25 Apr 2025 16:09:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E7=82=B9=E5=87=BB=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=85=A8=E9=83=A8=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/custom-echart-maps/index.vue | 4 ++-- src/components/custom-echart-pie-3d/index.vue | 4 ++-- src/hooks/useEcharts.js | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/custom-echart-maps/index.vue b/src/components/custom-echart-maps/index.vue index d692cec..8649598 100644 --- a/src/components/custom-echart-maps/index.vue +++ b/src/components/custom-echart-maps/index.vue @@ -68,8 +68,8 @@ export default { } setOptions(option); - onMapClick(({ name, data }) => { - emit('click', { name, data }); + onMapClick((data) => { + emit('click', data); }); startAutoPlay({ interval: 2000, diff --git a/src/components/custom-echart-pie-3d/index.vue b/src/components/custom-echart-pie-3d/index.vue index 11106d4..6c46cdf 100644 --- a/src/components/custom-echart-pie-3d/index.vue +++ b/src/components/custom-echart-pie-3d/index.vue @@ -59,8 +59,8 @@ export default { option.series = props.chartData; setOptions(option); resize(); - onMapClick(({ name, data }) => { - emit('click', { name, data }); + onMapClick((data) => { + emit('click', data); }); // getInstance()?.off('click', onClick); // getInstance()?.on('click', onClick); diff --git a/src/hooks/useEcharts.js b/src/hooks/useEcharts.js index e521323..24194a5 100644 --- a/src/hooks/useEcharts.js +++ b/src/hooks/useEcharts.js @@ -111,9 +111,10 @@ export const useEcharts = (elRef, theme = 'default') => { function handleMapClick(params) { console.info('handleMapClick', params); - console.info('seriesType', params.seriesType); + // 执行注册的回调函数 if (typeof mapClickHandler === 'function') { + console.info('mapClickHandler', params); mapClickHandler(params); } }