module.json5配置权限
"requestPermissions": [
{
"name": "ohos.permission.APPROXIMATELY_LOCATION",
"reason": "$string:location_tips",
"usedScene": {
"when": "inuse"
}
},
{
"name": "ohos.permission.LOCATION",
"reason": "$string:location_tips",
"usedScene": {
"when": "inuse"
}
}
]
页面使用:
uni.getLocation({
type: 'wgs84',
geocode: true,
isHighAccuracy: true,
success: function(res) {
_this.longitude = res.longitude
_this.latitude = res.latitude
console.log('location===', JSON.stringify(res));
},
啾啾 (作者)
上面的问题改了,还是空白,我又评论了一个日志,麻烦看下
2024-11-15 16:12