1. 程式人生 > 其它 >小程式開啟地圖導航

小程式開啟地圖導航

js: //開啟地圖導航 seeMap:function(e){ varme=this; letid=e.currentTarget.dataset.id; varstores=me.data.data.data; varlatitude=stores[id].latitude varlongitude=stores[id].longitude varname=stores[id].store_name vardetails=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: <viewclass="box2_son3_right2"data-id="{{index}}"bindtap="seeMap">   <imagesrc="../../images/icon/adr.png"/> </view> 參考來源:https://blog.csdn.net/qq_36538012/article/details/88396041