小程序打开地图导航


 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
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM