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.

Reference

Type

  1. (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

  1. Taro.openSetting({
  2. success: function (res) {
  3. console.log(res.authSetting)
  4. // res.authSetting = {
  5. // "scope.userInfo": true,
  6. // "scope.userLocation": true
  7. // }
  8. }
  9. })

API Support

API WeChat Mini-Program H5 React Native
Taro.openSetting ✔️