微信小程序經緯度獲取地圖導航(導航接入第三方)

API方法
wx.openLocation
咱們須要用到微信官方文檔的位置API wx.openLocation
其中的參數有不少,具體可參考官方文檔:微信官方文檔-位置javascript

所需參數java

latitude(必填) :緯度,範圍爲-90~90,負數表示南緯。使用 gcj02 國測局座標系;
longitude(必填) :經度,範圍爲-180~180,負數表示西經。使用 gcj02 國測局座標系;
scale(非必填) :縮放比例,範圍5~18;
name(非必填) :位置名稱(打開第三方導航前的定位描述);
address(非必填) :詳細地址信息(打開導航後的地址描述);git

wxml
bindtap="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

相關文章
相關標籤/搜索