小程序-地图-定位在我此时的位置
wxml:
<map id="mymap" latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}"></map>
wxss:
#mymap{width:100%;height:100vh}
js:
Page({
data:{
latitude:"",
longitude:"",
markers:[]
},
onLoad:function(){
wx.getLoction({
type:'gcj02',
success:function(res){
var latitude=res.latitude
var longitude=res.longitude
var speed=res.speed
var accuracy=res.accuracy
console.log("latitude"+latitude)
console.log("longitude"+longitude)
console.log("speed"+speed)
console.log("accuracy"+accuracy)
wx.openLocation({
latitude:latitude,
longitude:longitude,
scale:28
})
}
})
}
})