Skip to content

Commit

Permalink
feat(map): 地图优化
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Oct 20, 2020
1 parent d10d922 commit c4f43ad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ ol {
min-height: 100vh;
}
}

// 隐藏高德 Logo
.amap-logo,
.amap-copyright {
display: none !important;
}
5 changes: 3 additions & 2 deletions src/pages/components/components/marker/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import LockFilled from '@ant-design/icons/LockFilled';
import ShopOutlined from '@ant-design/icons/ShopOutlined';

import styles from './index.less';

// 聚合标记点
const Marker: React.FC = () => {
return (
<div className={styles.marker}>
<LockFilled />
<ShopOutlined />
</div>
);
};
Expand Down
9 changes: 3 additions & 6 deletions src/pages/components/map.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import { Map, Markers } from '@pansy/react-amap';
import { Map, Markers, ToolBar } from '@pansy/react-amap';
import { Marker } from './components';
import './map.less';

Expand All @@ -20,18 +20,15 @@ const MapComponent: React.FC = () => {
<PageContainer>
<div style={{ width: '100%', height: 800 }}>
<Map zoom={5}>
<ToolBar liteStyle offset={[10, 95]} />
<Markers
markers={markers}
useCluster={{
renderClusterMarker: ({ count, marker }) => {
return marker.setContent(`<div class="map-markers">${count}</div>`);
}
}}
render={() => {
return (
<Marker />
)
}}
render={() => <Marker />}
/>
</Map>
</div>
Expand Down

1 comment on commit c4f43ad

@vercel
Copy link

@vercel vercel bot commented on c4f43ad Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.