小程序打开地图导航

 js:
// 打开地图导航
  seeMap: function(e){
    var me = this;
    let id = e.currentTarget.dataset.id;
    var stores = me.data.data.data;
    var latitude = stores[id].latitude
    var longitude = stores[id].longitude
    var name = stores[id].store_name
    var details = stores[id].details
    wx.getLocation({
      type: 'wgs84', 
      success: function (res) {
        console.log('打开地图导航去目的地');
        wx.openLocation({//​使用微信内置地图查看位置。
          latitude: Number(latitude),//要去的纬度-地址
          longitude: Number(longitude),//要去的经度-地址
          name: name,
          address: details
        })
      }
    })
  },
 
 
wxml:
<view class="box2_son3_right2" data-id="{{index}}" bindtap="seeMap">
    <image src="../../images/icon/adr.png"/>
</view>

 

 

 

 

 
 
参考来源:https://blog.csdn.net/qq_36538012/article/details/88396041
 
posted @ 2021-12-21 16:00  宅女二二  阅读(1134)  评论(0)    收藏  举报