|
|
@ -23,6 +23,9 @@ const Example = (props) => { |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
|
|
|
|
const timer = setTimeout(() => { |
|
|
|
const map = new AMap.Map("amapId", { |
|
|
|
//resizeEnable: true,
|
|
|
|
center: [115.912663, 28.543149],//地图中心点,初始定位加载显示楼块
|
|
|
@ -34,9 +37,6 @@ const Example = (props) => { |
|
|
|
// rotation: 60
|
|
|
|
// showLabel: false
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//主题样式
|
|
|
|
let styleName = 'amap://styles/fb26776387242721c2fc32e2cb1daccc'; |
|
|
|
map.setMapStyle(styleName); |
|
|
|
|
|
|
@ -45,11 +45,16 @@ const Example = (props) => { |
|
|
|
window.onload = function () { |
|
|
|
windowOnload = true; |
|
|
|
} |
|
|
|
}, 100); |
|
|
|
|
|
|
|
//主题样式
|
|
|
|
|
|
|
|
return () => { |
|
|
|
const amapKeys = Object.keys(localStorage).filter(key => key.match(/^_AMap_/)) // 销毁地图
|
|
|
|
amapKeys.forEach(key => { |
|
|
|
localStorage.removeItem(key) |
|
|
|
}) |
|
|
|
clearTimeout(timer) |
|
|
|
} |
|
|
|
}, []) |
|
|
|
|
|
|
|