LoveQin
<script type="text/javascript">
    wx.config(jssdkconfig);

    require([\'jquery\', \'util\'], function($, util){
        var latitude;
        var longitude;
        var speed;
        var accuracy;
        wx.ready(function () {
            //test();
            wx.onMenuShareAppMessage(sharedata);

            wx.onMenuShareTimeline(sharedata);

            wx.onMenuShareQQ(sharedata);

            wx.onMenuShareWeibo(sharedata);
            
            wx.getLocation({
                type: \'wgs84\', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入\'gcj02\'
                success: function (res) {
                    latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
                    longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
                    speed = res.speed; // 速度,以米/每秒计
                    accuracy = res.accuracy; // 位置精度
                    alert(\'纬度:\'+latitude+\'经度:\'+longitude+\'速度:\'+speed+\'精度:\'+accuracy); 
                },
                cancel: function (res) {
                    alert(\'用户拒绝授权获取地理位置\');
                    aWeixinJSBridge.call(\'closeWindow\');  
                }
            });
        });

    });

</script>

这是针对微擎的html页面的js代码

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2021-08-22
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-30
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案