微信小程序---地圖API

這個城市看過美也看過醜陋,看過豪華的固然更可能是簡陋,咱們試着在這鋼筋結構中,搓出一點火星將渴望自由靈魂解救html

詳細請參考: https://developers.weixin.qq.com/miniprogram/dev/component/map.html

當前頁面中直接使用map標籤小程序

 

 

 地圖撐滿全屏api

 

 

 

經緯度顯示當前位置spa

 

詳情請參考: https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html

 

 

 

 

 

 

 地圖控件3d

 

詳細請查看: https://developers.weixin.qq.com/miniprogram/dev/component/map.html

 

 

 

讓地圖控件顯示在個人位置的中間 當前屏幕寬度-圖片一半 獲取小程序當前寬高度 (在全局中獲取) wx.getSystemInfo({}) https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html

 

 

實現位置變化(須要獲取實例)

 

 

拖動後返回本身的位置這時候須要第二個圖標了添加事件

 

 

點擊回到初始位置必需要有一個id值(事件已經在map標籤中產生了,自帶的)
https://developers.weixin.qq.com/miniprogram/dev/api/media/map/wx.createMapContext.html
MapContext.moveToLocation({})須要配合圖標使用 它是地圖控件因此要建立地圖的實例對象才能使用wx.createMapContext 經過wx.createMapContext在使用的頁面加載中就要建立 

相關文章
相關標籤/搜索