useEffect(() => {const loadAMap = () => {return new Promise((resolve, reject) => {if (window.AMap) {resolve(window.AMap);} else {const script = document.createElement('script');script.src = 'https://webapi.amap.com/maps?v=2.0&key=40335db62d1bb586ba8505e0c06ccac1';script.async = true;script.onerror = reject;script.onload = () => {resolve(window.AMap);};document.head.appendChild(script);}});};loadAMap().then((AMap) => {new AMap.Map('container', {viewMode: '2D',zoom: 17,center: [116.867982,36.683662 ]});}).catch((error) => {console.error('加载地图失败', error);})}, []);