Browse Source

地图渲染调整

release_0.0.4
‘lijianhao’ 3 years ago
parent
commit
e421eaed16
  1. 11
      web/client/src/sections/quanju/containers/example.js

11
web/client/src/sections/quanju/containers/example.js

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

Loading…
Cancel
Save