API方法wx.openLocation
咱们须要用到微信官方文档的位置API wx.openLocation
其中的参数有不少,具体可参考官方文档:微信官方文档-位置javascript
所需参数java
latitude(必填) :纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系;
longitude(必填) :经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系;
scale(非必填) :缩放比例,范围5~18;
name(非必填) :位置名称(打开第三方导航前的定位描述);
address(非必填) :详细地址信息(打开导航后的地址描述);git
wxmlbindtap="gomap"
微信
<view class="flex" style="align-items: center;" bindtap="gomap" data-name="{{item}}" data-page="map"> 导航 </view>
JSide
gomap(e) { const item=e.currentTarget.dataset.name wx.openLocation({ latitude: item.currLatitude, //维度 longitude: item.currLongitude, //经度 name: item.branchAdress, //目的地定位名称 scale: 15, //缩放比例 address: item.branchAdress+item.branchName //导航详细地址 }) },
效果图flex