Taro.getSetting(option)
Obtains the user's current settings. Only the permissions that have been requested by the Mini Program from the user are returned.
Type
(option?: Option) => Promise<SuccessCallbackResult>
Parameters
Option
Property | Type | Required | Description |
---|---|---|---|
complete | (res: any) => void | No | The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail | (res: any) => void | No | The callback function for a failed API call |
success | (res: Result) => void | No | The callback function for a successful API call |
SuccessCallbackResult
Property | Type | Description |
---|---|---|
authSetting | AuthSetting | Results of user authorization |
errMsg | string | Call result |
Sample Code
Taro.getSetting({
success: function (res) {
console.log(res.authSetting)
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
}
})
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.getSetting | ✔️ |