小程序获取当前位置信息,以及导航功能

1.查看微信小程序官方api
2.获取当前位置信息

  wx.getLocation({
      type: 'wgs84',
      success (res) {
        console.log(res)
      }
     })


3.导航到传入坐标去

wx.openLocation({
      latitude:"纬度",
      longitude:"经度",
      name:"名称",
      address:"具体地址",
      scale:18 //地图缩放比例
    })

posted @ 2021-04-01 15:25  PengXingQiang  阅读(326)  评论(0)    收藏  举报