WeChat アプレット開発ドキュメント
/ 微信小程序API 查看位置
微信小程序API 查看位置
wx.openLocation(OBJECT)
使用微信內(nèi)置地圖查看位置
OBEJCT參數(shù)說明:
示例代碼:
wx.getLocation({ type: 'gcj02', //返回可以用于wx.openLocation的經(jīng)緯度 success: function(res) { var latitude = res.latitude var longitude = res.longitude wx.openLocation({ latitude: latitude, longitude: longitude, scale: 28 }) } })
Bug & Tip
bug
:iOS
6.3.30
type 參數(shù)不生效,只會(huì)返回 wgs84 類型的坐標(biāo)信息tip
:wx.getLocation
、wx.chooseLocation
接口需要用戶授權(quán),請(qǐng)兼容用戶拒絕授權(quán)的場景。