在弄一个微信小程序,需要在后面调用用户位置信息,但是在wx.getLocation外面console里面的数值时候全部为空。怎么写?下面的console.log(latitude)才能取得里面获取到的数值?
.......
var latitude
var longitude
wx.getLocation({
type: 'wgs84',
success: (res) => {
latitude = res.latitude
longitude = res.longitude
}
})
console.log(latitude)
..........
伪代码