首页 > 微信 > 详细

小程序通过坐标请求腾讯位置服务获取当前位置信息

时间:2020-06-13 12:55:38      阅读:97      评论:0      收藏:0      [点我收藏+]
 getLocal(){
    let that=this;
    wx.getLocation({
      type: ‘gcj02‘,
      success(res) {
        const latitude = res.latitude
        const longitude = res.longitude
        console.log(latitude)
        console.log(longitude)
       that.getLocalMess(latitude,longitude)
      }
    })
  },
  getLocalMess(lat,lon){
    var _this = this;
    qqmapsdk.reverseGeocoder({
      //位置坐标,默认获取当前位置,非必须参数
      location: {
        latitude: lat,
        longitude: lon
      },
      success: function(res) {//成功后的回调
        console.log(res);
      },
      fail: function(error) {
        console.error(error);
      },
      complete: function(res) {
        console.log(res);
      }
    })
  },

 

小程序通过坐标请求腾讯位置服务获取当前位置信息

原文:https://www.cnblogs.com/dianzan/p/13113467.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!