未验证 提交 cfd4bd27 编写于 作者: O openharmony_ci 提交者: Gitee

!13823 翻译完成:12543 faqs更新

Merge pull request !13823 from wusongqing/TR12543
...@@ -212,5 +212,3 @@ The following conditions must be met: ...@@ -212,5 +212,3 @@ The following conditions must be met:
1. Before the redirection to the previous page, a confirm dialog box will be displayed. Note that **router.disableAlertBeforeBackPage** is used to disable the display of a confirm dialog box before returning to the previous page (default), and **router.enableAlertBeforeBackPage** is used to enable the display. 1. Before the redirection to the previous page, a confirm dialog box will be displayed. Note that **router.disableAlertBeforeBackPage** is used to disable the display of a confirm dialog box before returning to the previous page (default), and **router.enableAlertBeforeBackPage** is used to enable the display.
2. The system return key is used. 2. The system return key is used.
<!--no_check-->
\ No newline at end of file
...@@ -18,10 +18,10 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9 ...@@ -18,10 +18,10 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
1. Use the **onWindowStageCreate** to obtain a **windowClass** object. 1. Use the **onWindowStageCreate** to obtain a **windowClass** object.
``` ```ts
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// When the main window is created, set the main page for this ability. // When the main window is created, set the main page for this ability.
console.log("[Demo] MainAbility onWindowStageCreate") console.log("[Demo] EntryAbility onWindowStageCreate")
windowStage.getMainWindow((err, data) => { windowStage.getMainWindow((err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to obtain the main window.') console.error('Failed to obtain the main window.')
...@@ -35,7 +35,7 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9 ...@@ -35,7 +35,7 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
2. Enable the full-screen mode for the window and hide the status bar. 2. Enable the full-screen mode for the window and hide the status bar.
``` ```ts
globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => { globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err)); console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err));
...@@ -54,7 +54,7 @@ Use **window.getProperties()** to obtain the window properties. The **windowRect ...@@ -54,7 +54,7 @@ Use **window.getProperties()** to obtain the window properties. The **windowRect
Example: Example:
``` ```ts
let promise = windowClass.getProperties(); let promise = windowClass.getProperties();
promise.then((data)=> { promise.then((data)=> {
console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect)); console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect));
...@@ -70,7 +70,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -70,7 +70,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
Refer to the following code: Refer to the following code:
``` ```ts
window.getTopWindow(globalThis.mainContext).then(win => { window.getTopWindow(globalThis.mainContext).then(win => {
var systemBarProperties = { var systemBarProperties = {
statusBarColor: '#19B6FF', // Set the background color of the status bar. statusBarColor: '#19B6FF', // Set the background color of the status bar.
......
...@@ -106,8 +106,12 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -106,8 +106,12 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
2. Call **requestPermissionsFromUser** to request the permissions from end users in the form of a dialog box. This operation is required because the grant mode of both permissions is **user_grant**. 2. Call **requestPermissionsFromUser** to request the permissions from end users in the form of a dialog box. This operation is required because the grant mode of both permissions is **user_grant**.
``` ```
import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA'] let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA']
context.requestPermissionsFromUser(permissions).then((data) => { let atManager = abilityAccessCtrl.createAtManager();
// context is the ability-level context of the initiator UIAbility.
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
console.log("Succeed to request permission from user with data: " + JSON.stringify(data)) console.log("Succeed to request permission from user with data: " + JSON.stringify(data))
}).catch((error) => { }).catch((error) => {
console.log("Failed to request permission from user with error: " + JSON.stringify(error)) console.log("Failed to request permission from user with error: " + JSON.stringify(error))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册