亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Dokumentasi pembangunan applet WeChat / 微信小程序API 位置

微信小程序API 位置

wx.getLocation(OBJECT)

微信小程序獲取當(dāng)前的地理位置、速度

OBJECT參數(shù)說(shuō)明:

QQ截圖20170208113056.png

success返回參數(shù)說(shuō)明:

QQ截圖20170208113101.png

示例代碼:

wx.getLocation({
    type: 'wgs84',
    success: function (res) {
        var latitude = res.latitude; 
        var longitude = res.longitude; 
        var speed = res.speed; 
        var accuracy = res.accuracy; 
    }
});

wx.openLocation(OBJECT)——查看最新版本

微信小程序使用微信內(nèi)置地圖查看位置

OBEJCT參數(shù)說(shuō)明:

QQ截圖20170208113108.png

示例代碼:

wx.getLocation({
    type: 'gcj02', //返回可以用于wx.openLocation的經(jīng)緯度
    success: function (res) {
        var latitude = res.latitude; 
        var longitude = res.longitude; 
        wx.openLocation({
          latitude:latitude,
          longitude:logitude,
          scale:1
        })
    }
});