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',