小程序調用導航


wxml代碼:

<view class='nav-view' bindtap="nav">導航</view>

 

wxss代碼:

.nav{
width: 96%;
height:auto;
font-size: 32rpx;
color: white;
text-align: center;
background-color: #4d3b6b;
border-radius: 10px;
padding: 1.5vw;
margin: 0 auto;
margin-top: 40px;
}

 

js代碼:

//導航
nav:function(){
//使用微信內置地圖查看位置,地點的經緯度可用騰訊地圖坐標拾取器獲取(https://lbs.qq.com/tool/getpoint/
wx.getLocation({//獲取當前經緯度
type: 'wgs84', //返回可以用於wx.openLocation的經緯度,官方提示bug: iOS 6.3.30 type 參數不生效,只會返回 wgs84 類型的坐標信息
success: function (res) {
wx.openLocation({//?使用微信內置地圖查看位置。
latitude: 23.401303,//要去地點的緯度
longitude: 116.658567,///要去地點的經度-地址
name: " ",//
address: ' '
})
}
})
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM