【实例简介】
【实例截图】
【核心代码】
wx.config({
appId: '${appId}',
timestamp: parseInt("${timestamp}",10),
nonceStr: '${noncestr}',
signature: '${signature}',
jsApiList: [
'getLocation'
]
});
wx.ready(function(){
});
wx.error(function(res){
});
获取地理位置
function submitOrderInfoClick(){
wx.getLocation({
success: function (res) {
alert("经纬度为:(" res.latitude "," res.longitude ")" );
},
fail: function(error) {
alert("获取地理位置失败,请确保开启GPS且允许微信获取您的地理位置!");
}
});
}