From 78fefd2e70d4ec5bd82e71b7ed9ee99a5e742a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98lijianhao=E2=80=99?= Date: Tue, 26 Jul 2022 16:03:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E9=94=80=E6=AF=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/quanju/containers/example.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/web/client/src/sections/quanju/containers/example.js b/web/client/src/sections/quanju/containers/example.js index 28db5bec..d5993a86 100644 --- a/web/client/src/sections/quanju/containers/example.js +++ b/web/client/src/sections/quanju/containers/example.js @@ -25,9 +25,9 @@ const Example = (props) => { useEffect(() => { const map = new AMap.Map("amapId", { //resizeEnable: true, - center: [115.880421, 28.529637],//地图中心点,初始定位加载显示楼块 + center: [115.912663, 28.543149],//地图中心点,初始定位加载显示楼块 // center: [115.857952, 28.683003],//地图中心点 - zoom: 8,//地图显示的缩放级别 + zoom: 13,//地图显示的缩放级别 zooms: [8, 18], pitch: 65, // 地图俯仰角度,有效范围 0 度- 83 度 viewMode: '3D', // 地图模式 @@ -45,9 +45,11 @@ const Example = (props) => { window.onload = function () { windowOnload = true; } - return () =>{ - map.destroy(); //销毁地图 - map=null + return () => { + const amapKeys = Object.keys(localStorage).filter(key => key.match(/^_AMap_/)) // 销毁地图 + amapKeys.forEach(key => { + localStorage.removeItem(key) + }) } }, [])