小程序打開地圖導航


 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