|
|
|
@ -12,7 +12,7 @@
@@ -12,7 +12,7 @@
|
|
|
|
|
@reset="handleMapReset" |
|
|
|
|
/> |
|
|
|
|
<div id="mapview" ref="mapview"> |
|
|
|
|
<div id="mapPanel" ref="mapPanel"/> |
|
|
|
|
<div v-show="navigatePanel" id="mapPanel" ref="mapPanel"/> |
|
|
|
|
</div> |
|
|
|
|
<div v-show="sidebarControl" class="operatePanel"> |
|
|
|
|
<div class="operatePanel-arrow" @click="toggleOperatePanel()"> |
|
|
|
@ -124,6 +124,11 @@
@@ -124,6 +124,11 @@
|
|
|
|
|
}, |
|
|
|
|
toolbarHeight: propTypes.number.def(48), |
|
|
|
|
toolbarControl: propTypes.bool.def(true), |
|
|
|
|
mapControl: { |
|
|
|
|
type: Array as PropType<string[]>, |
|
|
|
|
default: () => ['toolBar', 'controlBar', 'scale', 'mapType'] |
|
|
|
|
}, |
|
|
|
|
navigatePanel: propTypes.bool.def(true) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let map; |
|
|
|
@ -248,14 +253,21 @@
@@ -248,14 +253,21 @@
|
|
|
|
|
// 创建地图实例 |
|
|
|
|
map = new AMap.Map(instance.refs.mapview, mapState.mapConfig.options); |
|
|
|
|
map.plugin(['AMap.ToolBar', 'AMap.MapType', 'AMap.ControlBar', 'AMap.Scale'], () => { |
|
|
|
|
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({ |
|
|
|
@ -263,6 +275,7 @@
@@ -263,6 +275,7 @@
|
|
|
|
|
showRoad: true |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
map.on('zoomchange', ctx => { |
|
|
|
|
mapState.defaultZoom = subtract(divide(map.getZoom(),2), 1); |
|
|
|
|