地图

<Amap>
<!-- 覆盖物 -->
</Amap>

Source Code

Props

属性名类型备注
centernumber[2]
zoomnumber
rotationnumber
pitchnumber
viewMode'2D', '3D'
featuresstring[]
zoomsnumber[2]
dragEnableboolean
zoomEnableboolean
jogEnableboolean
pitchEnableboolean
rotateEnableboolean
animateEnableboolean
keyboardEnableboolean
doubleClickZoomboolean
scrollWheelboolean
touchZoomboolean
touchZoomCenterboolean
showLabelboolean
defaultCursorstring
isHotspotboolean
mapStylestring
wallColorstring
roofColorstring
skyColorstring
showBuildingBlockboolean
showIndoorMapboolean
masknumber[][], number[][][]

Events

事件名备注
complete
click
dblclick
rightclick
mapmove
movestart
moveend
hotspotclick
hotspotover
hotspotout
mousemove
mousewheel
mouseover
mouseup
mousedown
zoomchange
zoomstart
zoomend
dragstart
dragging
dragend
resize
touchstart
touchmove
touchend

Amap.AmapContext

当你需要开发自定义扩展组件时,可以在子组件里使用Context来获取组件树上父级或祖先级的AMap.Map实例。

<AmapContext.Consumer>
{(map) => {
// map: AMap.Map | undefined
}}
</AmapContext.Consumer>

如果你使用的Functional Component和 React Hooks,推荐使用useAmap()

Example

查看源代码: