diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md index 0fe95d99b9c0e1dcf38e62ce2a622749cd34e7b8..7c05cca994f75b2b7de95593cd1491544f836670 100644 --- a/zh-cn/application-dev/security/accesstoken-guidelines.md +++ b/zh-cn/application-dev/security/accesstoken-guidelines.md @@ -370,7 +370,7 @@ 通过调用[requestPermissionsFromUser()](../reference/apis/js-apis-inner-app-context.md#contextrequestpermissionsfromuser7)接口向用户动态申请授权。 -```js +```ts import { BusinessError } from '@ohos.base'; import featureAbility from '@ohos.ability.featureAbility'; @@ -378,7 +378,7 @@ reqPermissions() { let context = featureAbility.getContext(); let array:Array = ["ohos.permission.PERMISSION2"]; //requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 - context.requestPermissionsFromUser(array, 1).then(function(data) { + context.requestPermissionsFromUser(array, 1).then(data => { console.log("data:" + JSON.stringify(data)); console.log("data permissions:" + JSON.stringify(data.permissions)); console.log("data result:" + JSON.stringify(data.authResults));