微信小程序-地圖事件


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

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM