wxml:
<view>
<button type="primary" bindtap="clicktop">地图</button>
</view>
js:
Page({
data: {
markers: [], //地图参数:
latitude: "", //纬度
longitude: "", //经度
},
clicktop(e) {
let that = this;
wx.getLocation({
type: 'wgs84',
success(res){
wx.openLocation({
latitude: res.latitude,
longitude: res.longitude,
scale:18,
success:function(res){
wx.chooseLocation({
success(res){
console.log(res);
}
})
}
})
},
fail:function(err){
console.log(err);
}
})
},
})