From f8768b5f330c4bfd98191d08a2c3f7c7ff2cda69 Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Fri, 29 Dec 2023 13:22:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9C=B0=E5=9B=BE=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/echarts/MyEchartMap.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/echarts/MyEchartMap.vue b/src/components/echarts/MyEchartMap.vue index 714f813..1f6c54b 100644 --- a/src/components/echarts/MyEchartMap.vue +++ b/src/components/echarts/MyEchartMap.vue @@ -30,14 +30,14 @@ const fetchConfig = async (name: string) => { const emit = defineEmits(['getRegionByRegionId']) onMounted(() => { - GetEchar() + GetEchar('中国') }) -const GetEchar = async () => { +const GetEchar = async (name:string) => { let chartDom = document.getElementById('chartMap') myCharts.value = echarts.init(chartDom) - echarts.registerMap('china', await fetchConfig('中国')) //注册可用的地图 + echarts.registerMap('china', await fetchConfig(name)) //注册可用的地图 var option = { geo: { map: 'china', @@ -116,6 +116,8 @@ const GetEchar = async () => { // 点击事件 myCharts.value.on('click', e => { + console.log('🚀 ~ file: MyEchartMap.vue:139 ~ GetEchar ~ e:', e.name) + GetEchar(e.name) emit('getRegionByRegionId', e.data) myCharts.value.dispatchAction({ type: 'downplay',