Taro.getSystemInfo({
success: function (res) {
if (!res.locationEnabled || !res.locationAuthorized) {
Taro.showToast({
title: '请开启手机定位功能'
})
} else {
Taro.getLocation({
type: "wgs84",
isHighAccuracy: true,
success(res) {
// 成功进行的操作
},
fail () {
Taro.getSetting({
success: function (res) {
if (!res.authSetting['scope.userLocation']) {
Taro.showModal({
content: '检测到您未打开地理位置授权,是否前往开启',
confirmText: '去开启',
success: function (res) {
if (res.confirm) {
Taro.openSetting();
} else {
console.log('get location fail');
}
}
})
}
}
})
}
})
}
}
})
微信小程序拒绝定位之后 如何再次开启以及判断是否打开了系统定位功能
于 2022-03-25 09:58:59 首次发布