<map class='map' id='myMap' longitude="{{longitude}}" latitude="{{latitude}}" scale="{{scale}}" show-location="true" markers="{{markers}}" bindmarkertap="bindMakertap" bindcontroltap='controlTap' bindregionchange='regionChange' controls='{{controls}}' bindtap='bindMapTap'>
- id :map 組件的 id,在 wx.createMapContext(mapId, this) 中需要用到
- longitude :map 組件的中心經度
- latitude:map 組件的中心緯度
- scale:縮放級別,取值范圍為5-18,默認為16
- show-location:顯示帶有方向的當前定位點,即顯示代表當前位置的藍色定位點圖標,另外 mapContext 的 moveToLocation() 方法在官方文檔有着這樣的說明(將地圖中心移動到當前定位點,需要配合map組件的show-location使用)
- markers:標記點用於在地圖上顯示標記的位置,是一個數組對象
- bindmarkertap:點擊 marker 標記點時觸發
- bindcontroltap:點擊控件時觸發
- bindregionchange:拖動地圖觸發
- controls:在地圖上顯示控件,控件不隨着地圖移動,是一個數組對象
- bindtap: 點擊地圖時觸發(拖動地圖時不會觸發點擊)