//获取应用实例
var app = getApp()
Page({
data: {
latitude:’’,
longitude:’’
},
onLoad: function () {
console.log(‘地图定位!’)
var that = this
wx.getLocation({
type: ‘gcj02’, //返回可以用于wx.openLocation的经纬度
success: function (res) {
//console.log(res)
var latitude = res.latitude;
var longitude = res.longitude;
wx.openLocation({
latitude:latitude,
longitude:longitude,
scale:1
})
}
});
},
})
本地测试无法获取到定位,怎么回事啊