| | |
| | | }); |
| | | let geoJson = {}; |
| | | async function getGeo() { |
| | | geoJson = (await import(`../../../public/mapJson/${name.value}.json`)) |
| | | .default; |
| | | const dynamicPath = `mapJson/${name.value}.json`; |
| | | try { |
| | | const response = await fetch(dynamicPath); |
| | | if (!response.ok) { |
| | | throw new Error(`HTTP error! status: ${response.status}`); |
| | | } |
| | | const data = await response.json(); |
| | | // jsonData.value = data; |
| | | geoJson = data; |
| | | |
| | | echarts.registerMap(name.value, geoJson); |
| | | } catch (error) { |
| | | console.error('加载 JSON 出错:', error); |
| | | } |
| | | } |
| | | |
| | | async function setMapName() { |