diff --git a/src/components/AMap/src/AMapDesigner/index.vue b/src/components/AMap/src/AMapDesigner/index.vue
index 845a021..65ff78c 100644
--- a/src/components/AMap/src/AMapDesigner/index.vue
+++ b/src/components/AMap/src/AMapDesigner/index.vue
@@ -12,7 +12,7 @@
@reset="handleMapReset"
/>
@@ -124,6 +124,11 @@
},
toolbarHeight: propTypes.number.def(48),
toolbarControl: propTypes.bool.def(true),
+ mapControl: {
+ type: Array as PropType,
+ default: () => ['toolBar', 'controlBar', 'scale', 'mapType']
+ },
+ navigatePanel: propTypes.bool.def(true)
});
let map;
@@ -248,21 +253,29 @@
// 创建地图实例
map = new AMap.Map(instance.refs.mapview, mapState.mapConfig.options);
map.plugin(['AMap.ToolBar', 'AMap.MapType', 'AMap.ControlBar', 'AMap.Scale'], () => {
- // 地图操作工具条插件
- map.addControl(new AMap.ToolBar());
- // 组合了旋转,倾斜,复位,缩放插件
- map.addControl(new AMap.ControlBar());
- // 比例尺插件
- const scale = new AMap.Scale();
- scale.show();
- map.addControl(scale);
- // 地图类型切换插件
- map.addControl(
- new AMap.MapType({
- defaultType: 0,
- showRoad: true
- })
- );
+ if (mapProps.mapControl?.includes('toolBar')) {
+ // 地图操作工具条插件
+ map.addControl(new AMap.ToolBar());
+ }
+ if (mapProps.mapControl?.includes('controlBar')) {
+ // 组合了旋转,倾斜,复位,缩放插件
+ map.addControl(new AMap.ControlBar());
+ }
+ if (mapProps.mapControl?.includes('scale')) {
+ // 比例尺插件
+ const scale = new AMap.Scale();
+ scale.show();
+ map.addControl(scale);
+ }
+ if (mapProps.mapControl?.includes('mapType')) {
+ // 地图类型切换插件
+ map.addControl(
+ new AMap.MapType({
+ defaultType: 0,
+ showRoad: true
+ })
+ );
+ }
});
map.on('zoomchange', ctx => {
mapState.defaultZoom = subtract(divide(map.getZoom(),2), 1);