title: Taro.openSetting(option)
sidebar_label: openSetting
Opens the Mini Program settings interface on WeChat and returns setting results. Only the permissions that have been requested by the Mini Program from the user are displayed on the settings interface.
Note: As of the base library 2.3.0, only when the user taps at a specific location can the user be navigated to the settings page to manage authorization information. Details.
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.openSetting({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.openSetting | ✔️ |
