diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md index 445fcdeecd2d788663ec8a33c0a970491fe0ea4b..eea99f1d5929f72dbfae11314c3d2c7e8acba030 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));