小程序调用导航

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: ' '
})
}
})
}

posted @ 2019-07-19 16:53  远方的异特  阅读(3156)  评论(0编辑  收藏  举报