diff --git a/en/application-dev/reference/apis/js-apis-system-parameter.md b/en/application-dev/reference/apis/js-apis-system-parameter.md
index aab6d05c91656e7b386499302e2ab11b021ba937..0056acb94e082bf1dd035366b059b1ca876e6112 100644
--- a/en/application-dev/reference/apis/js-apis-system-parameter.md
+++ b/en/application-dev/reference/apis/js-apis-system-parameter.md
@@ -1,8 +1,8 @@
# @ohos.systemParameter (System Parameter)
The **SystemParameter** module provides system services with easy access to key-value pairs. You can use the APIs provided by this module to describe the service status and change the service behavior. The basic operation primitives are get and set. You can obtain the values of system parameters through getters and modify the values through setters.
-For details about the system parameter design principles and definitions, see
-[Service Management](../../../device-dev/subsystems/subsys-boot-init-sysparam.md).
+
+For details about the system parameter design principles and definitions, see [Parameter Management](../../../device-dev/subsystems/subsys-boot-init-sysparam.md).
> **NOTE**
> - The APIs of this module are no longer maintained since API version 9. It is recommended that you use [@ohos.systemParameterEnhance](js-apis-system-parameterEnhance.md) instead.
@@ -14,7 +14,7 @@ For details about the system parameter design principles and definitions, see
## Modules to Import
```ts
-import systemparameter from '@ohos.systemparameter'
+import systemparameter from '@ohos.systemparameter';
```
## systemparameter.getSync(deprecated)
@@ -30,19 +30,19 @@ Obtains the value of the system parameter with the specified key.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system parameter.|
-| def | string | No| Default value of the system parameter.
It works only when the system parameter does not exist.
The value can be **undefined** or any custom value. |
+| def | string | No| Default value of the system parameter.
It works only when the system parameter does not exist.
The value can be **undefined** or any custom value.|
**Return value**
| Type| Description|
| -------- | -------- |
-| string | Value of the system parameter.
If the specified key exists, the set value is returned.
If the specified key does not exist and **def** is set to a valid value, the set value is returned. If the specified key does not exist and **def** is set to an invalid value (such as **undefined**) or is not set, an empty string is returned. |
+| string | Value of the system parameter.
If the specified key exists, the set value is returned.
If the specified key does not exist and **def** is set to a valid value, the set value is returned. If the specified key does not exist and **def** is set to an invalid value (such as **undefined**) or is not set, an empty string is returned.|
**Example**
```ts
try {
- var info = systemparameter.getSync("const.ohos.apiversion");
+ let info = systemparameter.getSync("const.ohos.apiversion");
console.log(JSON.stringify(info));
} catch(e) {
console.log("getSync unexpected error: " + e);
@@ -67,8 +67,10 @@ Obtains the value of the system parameter with the specified key. This API uses
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- systemparameter.get("const.ohos.apiversion", function (err, data) {
+ systemparameter.get("const.ohos.apiversion", (err: BusinessError, data: string) => {
if (err == undefined) {
console.log("get test.parameter.key value success:" + data)
} else {
@@ -98,8 +100,10 @@ Obtains the value of the system parameter with the specified key. This API uses
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- systemparameter.get("const.ohos.apiversion", "default", function (err, data) {
+ systemparameter.get("const.ohos.apiversion", "default", (err: BusinessError, data: string) => {
if (err == undefined) {
console.log("get test.parameter.key value success:" + data)
} else {
@@ -124,7 +128,7 @@ Obtains the value of the system parameter with the specified key. This API uses
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system parameter.|
-| def | string | No| Default value of the system parameter.
It works only when the system parameter does not exist.
The value can be **undefined** or any custom value. |
+| def | string | No| Default value of the system parameter.
It works only when the system parameter does not exist.
The value can be **undefined** or any custom value.|
**Return value**
@@ -135,11 +139,13 @@ Obtains the value of the system parameter with the specified key. This API uses
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- var p = systemparameter.get("const.ohos.apiversion");
- p.then(function (value) {
+ let p = systemparameter.get("const.ohos.apiversion");
+ p.then((value: string) => {
console.log("get test.parameter.key success: " + value);
- }).catch(function (err) {
+ }).catch((err: BusinessError) => {
console.log("get test.parameter.key error: " + err.code);
});
} catch(e) {
@@ -200,8 +206,10 @@ Sets a value for the system parameter with the specified key. This API uses an a
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- systemparameter.set("test.parameter.key", "testValue", function (err, data) {
+ systemparameter.set("test.parameter.key", "testValue", (err: BusinessError, data: void) =>{
if (err == undefined) {
console.log("set test.parameter.key value success :" + data)
} else {
@@ -240,11 +248,13 @@ Sets a value for the system parameter with the specified key. This API uses a pr
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- var p = systemparameter.set("test.parameter.key", "testValue");
- p.then(function (value) {
+ let p = systemparameter.set("test.parameter.key", "testValue");
+ p.then((value: void) => {
console.log("set test.parameter.key success: " + value);
- }).catch(function (err) {
+ }).catch((err: BusinessError) => {
console.log(" set test.parameter.key error: " + err.code);
});
} catch(e) {
diff --git a/en/application-dev/reference/apis/js-apis-system-parameterEnhance.md b/en/application-dev/reference/apis/js-apis-system-parameterEnhance.md
index dabeb1bad7572458974e0330990f745c285bae0e..8937d4c8aad226599976789b93d2b888c3452af0 100644
--- a/en/application-dev/reference/apis/js-apis-system-parameterEnhance.md
+++ b/en/application-dev/reference/apis/js-apis-system-parameterEnhance.md
@@ -1,8 +1,8 @@
# @ohos.systemParameterEnhance (System Parameter)
The **SystemParameter** module provides system services with easy access to key-value pairs. You can use the APIs provided by this module to describe the service status and change the service behavior. The basic operation primitives are get and set. You can obtain the values of system parameters through getters and modify the values through setters.
-For details about the system parameter design principles and definitions, see
-[Service Management](../../../device-dev/subsystems/subsys-boot-init-sysparam.md).
+
+For details about the system parameter design principles and definitions, see [Parameter Management](../../../device-dev/subsystems/subsys-boot-init-sysparam.md).
> **NOTE**
>
@@ -13,7 +13,7 @@ For details about the system parameter design principles and definitions, see
## Modules to Import
```ts
-import systemparameter from '@ohos.systemParameterEnhance'
+import systemparameter from '@ohos.systemParameterEnhance';
```
## systemparameter.getSync
@@ -29,19 +29,30 @@ Obtains the value of the system parameter with the specified key.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system parameter.|
-| def | string | No| Default value of the system parameter.
It works only when the system parameter does not exist.
The value can be **undefined** or any custom value. |
+| def | string | No| Default value of the system parameter.
It works only when the system parameter does not exist.
The value can be **undefined** or any custom value.|
**Return value**
| Type| Description|
| -------- | -------- |
-| string | Value of the system parameter.
If the specified key exists, the set value is returned.
If the specified key does not exist and **def** is set to a valid value, the set value is returned. If the specified key does not exist and **def** is set to an invalid value (such as **undefined**) or is not set, an exception is thrown. |
+| string | Value of the system parameter.
If the specified key exists, the set value is returned.
If the specified key does not exist and **def** is set to a valid value, the set value is returned. If the specified key does not exist and **def** is set to an invalid value (such as **undefined**) or is not set, an exception is thrown.|
+
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 14700101 | System parameter can not be found. |
+| 14700102 | System parameter value is invalid. |
+| 14700103 | System permission operation permission denied. |
+| 14700104 | System internal error including out of memory, deadlock etc. |
+
+For details about the error codes, see [System Parameter Error Codes](../errorcodes/errorcode-system-parameterV9.md).
**Example**
```ts
try {
- var info = systemparameter.getSync("const.ohos.apiversion");
+ let info = systemparameter.getSync("const.ohos.apiversion");
console.log(JSON.stringify(info));
} catch(e) {
console.log("getSync unexpected error: " + e);
@@ -63,11 +74,24 @@ Obtains the value of the system parameter with the specified key.
| key | string | Yes| Key of the system parameter.|
| callback | AsyncCallback<string> | Yes| Callback used to return the result.|
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 14700101 | System parameter can not be found. |
+| 14700102 | System parameter value is invalid. |
+| 14700103 | System permission operation permission denied. |
+| 14700104 | System internal error including out of memory, deadlock etc. |
+
+For details about the error codes, see [System Parameter Error Codes](../errorcodes/errorcode-system-parameterV9.md).
+
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- systemparameter.get("const.ohos.apiversion", function (err, data) {
+ systemparameter.get("const.ohos.apiversion", (err: BusinessError, data: string) => {
if (err == undefined) {
console.log("get test.parameter.key value success:" + data)
} else {
@@ -94,11 +118,24 @@ Obtains the value of the system parameter with the specified key. This API uses
| def | string | Yes| Default value.|
| callback | AsyncCallback<string> | Yes| Callback used to return the result.|
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 14700101 | System parameter can not be found. |
+| 14700102 | System parameter value is invalid. |
+| 14700103 | System permission operation permission denied. |
+| 14700104 | System internal error including out of memory, deadlock etc. |
+
+For details about the error codes, see [System Parameter Error Codes](../errorcodes/errorcode-system-parameterV9.md).
+
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- systemparameter.get("const.ohos.apiversion", "default", function (err, data) {
+ systemparameter.get("const.ohos.apiversion", "default", (err: BusinessError, data: string) => {
if (err == undefined) {
console.log("get test.parameter.key value success:" + data)
} else {
@@ -123,7 +160,7 @@ Obtains the value of the system parameter with the specified key. This API uses
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system parameter.|
-| def | string | No| Default value of the system parameter.
It works only when the system parameter does not exist.
The value can be **undefined** or any custom value. |
+| def | string | No| Default value of the system parameter.
It works only when the system parameter does not exist.
The value can be **undefined** or any custom value.|
**Return value**
@@ -131,14 +168,27 @@ Obtains the value of the system parameter with the specified key. This API uses
| -------- | -------- |
| Promise<string> | Promise used to return the execution result.|
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 14700101 | System parameter can not be found. |
+| 14700102 | System parameter value is invalid. |
+| 14700103 | System permission operation permission denied. |
+| 14700104 | System internal error including out of memory, deadlock etc. |
+
+For details about the error codes, see [System Parameter Error Codes](../errorcodes/errorcode-system-parameterV9.md).
+
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- var p = systemparameter.get("const.ohos.apiversion");
- p.then(function (value) {
+ let p = systemparameter.get("const.ohos.apiversion");
+ p.then((value: string) => {
console.log("get test.parameter.key success: " + value);
- }).catch(function (err) {
+ }).catch((err: BusinessError) => {
console.log("get test.parameter.key error: " + err.code);
});
} catch(e) {
@@ -161,9 +211,21 @@ Sets a value for the system parameter with the specified key.
| key | string | Yes| Key of the system parameter.|
| value | string | Yes| Value of the system parameter to set.|
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 14700102 | System parameter value is invalid. |
+| 14700103 | System permission operation permission denied. |
+| 14700104 | System internal error including out of memory, deadlock etc. |
+
+For details about the error codes, see [System Parameter Error Codes](../errorcodes/errorcode-system-parameterV9.md).
+
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
systemparameter.setSync("test.parameter.key", "default");
} catch(e) {
@@ -187,11 +249,23 @@ Sets a value for the system parameter with the specified key. This API uses an a
| value | string | Yes| Value of the system parameter to set.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 14700102 | System parameter value is invalid. |
+| 14700103 | System permission operation permission denied. |
+| 14700104 | System internal error including out of memory, deadlock etc. |
+
+For details about the error codes, see [System Parameter Error Codes](../errorcodes/errorcode-system-parameterV9.md).
+
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- systemparameter.set("test.parameter.key", "testValue", function (err, data) {
+ systemparameter.set("test.parameter.key", "testValue", (err: BusinessError, data: void) => {
if (err == undefined) {
console.log("set test.parameter.key value success :" + data)
} else {
@@ -223,14 +297,26 @@ Sets a value for the system parameter with the specified key. This API uses a pr
| -------- | -------- |
| Promise<void> | Promise used to return the execution result.|
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 14700102 | System parameter value is invalid. |
+| 14700103 | System permission operation permission denied. |
+| 14700104 | System internal error including out of memory, deadlock etc. |
+
+For details about the error codes, see [System Parameter Error Codes](../errorcodes/errorcode-system-parameterV9.md).
+
**Example**
```ts
+import { BusinessError } from '@ohos.base';
+
try {
- var p = systemparameter.set("test.parameter.key", "testValue");
- p.then(function (value) {
+ let p = systemparameter.set("test.parameter.key", "testValue");
+ p.then((value: void) => {
console.log("set test.parameter.key success: " + value);
- }).catch(function (err) {
+ }).catch((err: BusinessError) => {
console.log(" set test.parameter.key error: " + err.code);
});
} catch(e) {
diff --git a/en/application-dev/reference/apis/js-apis-uitest.md b/en/application-dev/reference/apis/js-apis-uitest.md
index f3ed68ea09339eec7f3b2901b7e3d2037bf47108..482273df5f86812fceecaa5e201429053ce2b034 100644
--- a/en/application-dev/reference/apis/js-apis-uitest.md
+++ b/en/application-dev/reference/apis/js-apis-uitest.md
@@ -19,7 +19,7 @@ This module provides the following functions:
## Modules to Import
-```js
+```ts
import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton, UIElementInfo, UIEventObserver} from '@ohos.UiTest';
```
@@ -165,7 +165,8 @@ The API capabilities provided by the **On** class exhibit the following features
All APIs provided in the **On** class are synchronous. You are advised to use the static constructor **ON** to create an **On** object in chain mode.
-```js
+```ts
+import { ON } from '@ohos.UiTest';
ON.text('123').type('button');
```
@@ -192,11 +193,11 @@ Specifies the text attribute of the target component. Multiple match patterns ar
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.text('123'); // Use the static constructor ON to create an On object and specify the text attribute of the target component.
```
-
### id9+
id(id: string): On
@@ -219,7 +220,8 @@ Specifies the ID attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.id('123'); // Use the static constructor ON to create an On object and specify the ID attribute of the target component.
```
@@ -246,7 +248,8 @@ Specifies the type attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.type('button'); // Use the static constructor ON to create an On object and specify the type attribute of the target component.
```
@@ -273,7 +276,8 @@ Specifies the clickable status attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.clickable(true); // Use the static constructor ON to create an On object and specify the clickable status attribute of the target component.
```
@@ -299,7 +303,8 @@ Specifies the long-clickable status attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.longClickable(true); // Use the static constructor ON to create an On object and specify the long-clickable status attribute of the target component.
```
@@ -326,7 +331,8 @@ Specifies the scrollable status attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.scrollable(true); // Use the static constructor ON to create an On object and specify the scrollable status attribute of the target component.
```
@@ -352,7 +358,8 @@ Specifies the enabled status attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.enabled(true); // Use the static constructor ON to create an On object and specify the enabled status attribute of the target component.
```
@@ -378,7 +385,8 @@ Specifies the focused status attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.focused(true); // Use the static constructor ON to create an On object and specify the focused status attribute of the target component.
```
@@ -404,7 +412,8 @@ Specifies the selected status attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.selected(true); // Use the static constructor ON to create an On object and specify the selected status attribute of the target component.
```
@@ -430,7 +439,8 @@ Specifies the checked status attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.checked(true); // Use the static constructor ON to create an On object and specify the checked status attribute of the target component.
```
@@ -456,7 +466,8 @@ Specifies the checkable status attribute of the target component.
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.checkable(true); // Use the static constructor ON to create an On object and specify the checkable status attribute of the target component.
```
@@ -482,7 +493,8 @@ Specifies that the target component is located before the given attribute compon
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.isBefore(ON.text('123')); // Create an On object using the static constructor ON, specifying that the target component is located before the given attribute component.
```
@@ -508,7 +520,8 @@ Specifies that the target component is located after the given attribute compone
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.isAfter(ON.text('123')); // Create an On object using the static constructor ON, specifying that the target component is located after the given attribute component.
```
@@ -534,7 +547,8 @@ Specifies that the target component is located within the given attribute compon
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.within(ON.type('List')); // Create an On object using the static constructor ON, specifying that the target component is located within the given attribute component.
```
@@ -560,7 +574,8 @@ Specifies that the target component is located within the given application wind
**Example**
-```js
+```ts
+import { ON } from '@ohos.UiTest';
let on = ON.inWindow('com.uitestScene.acts'); // Create an On object using the static constructor ON, specifying that the target component is located within the given application window.
```
@@ -589,7 +604,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -616,7 +632,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -643,7 +660,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -676,7 +694,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -709,7 +728,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -742,7 +762,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -775,7 +796,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -808,7 +830,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -841,7 +864,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -855,7 +879,7 @@ async function demo() {
### isLongClickable9+
-isLongClickable(): Promise\
+isLongClickable(): Promise\
Obtains the long-clickable status of this component.
@@ -878,7 +902,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -915,7 +940,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let checkBox = await driver.findComponent(ON.type('Checkbox'));
@@ -952,7 +978,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let checkBox = await driver.findComponent(ON.type('Checkbox'));
@@ -989,7 +1016,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let scrollBar = await driver.findComponent(ON.scrollable(true));
@@ -1027,7 +1055,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -1065,7 +1094,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -1102,7 +1132,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -1139,7 +1170,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let text = await driver.findComponent(ON.text('hello world'));
@@ -1164,7 +1196,8 @@ Clears text in this component. This API is applicable to text boxes.
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let text = await driver.findComponent(ON.text('hello world'));
@@ -1203,7 +1236,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let scrollBar = await driver.findComponent(ON.type('Scroll'));
@@ -1236,7 +1270,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let scrollBar = await driver.findComponent(ON.type('Scroll'));
@@ -1269,7 +1304,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let scrollBar = await driver.findComponent(ON.type('Scroll'));
@@ -1302,7 +1338,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.type('button'));
@@ -1336,7 +1373,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let image = await driver.findComponent(ON.type('image'));
@@ -1369,7 +1407,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let image = await driver.findComponent(ON.type('image'));
@@ -1407,7 +1446,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
}
@@ -1437,7 +1477,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.delayMs(1000);
@@ -1474,7 +1515,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.findComponent(ON.text('next page'));
@@ -1511,7 +1553,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let buttonList = await driver.findComponents(ON.text('next page'));
@@ -1548,7 +1591,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -1586,7 +1630,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let button = await driver.waitForComponent(ON.text('next page'),500);
@@ -1618,7 +1663,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ON } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.assertComponentExist(ON.text('next page'));
@@ -1643,7 +1689,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.pressBack();
@@ -1674,7 +1721,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.triggerKey(123);
@@ -1707,7 +1755,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.triggerCombineKeys(2072, 2047, 2035);
@@ -1740,7 +1789,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.click(100,100);
@@ -1772,7 +1822,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.doubleClick(100,100);
@@ -1804,7 +1855,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.longClick(100,100);
@@ -1839,7 +1891,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.swipe(100,100,200,200,600);
@@ -1874,7 +1927,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.drag(100,100,200,200,600);
@@ -1911,7 +1965,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.screenCap('/data/storage/el2/base/cache/1.png');
@@ -1942,7 +1997,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, DisplayRotation } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.setDisplayRotation(DisplayRotation.ROTATION_180);
@@ -1973,7 +2029,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let rotation = await driver.getDisplayRotation();
@@ -2004,7 +2061,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.setDisplayRotationEnabled(false);
@@ -2035,7 +2093,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let size = await driver.getDisplaySize();
@@ -2066,7 +2125,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let density = await driver.getDisplayDensity();
@@ -2091,7 +2151,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.wakeUpDisplay();
@@ -2116,7 +2177,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.pressHome();
@@ -2154,7 +2216,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let idled = await driver.waitForIdle(4000,5000);
@@ -2188,7 +2251,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.fling({x: 500, y: 480},{x: 450, y: 480},5,600);
@@ -2226,7 +2290,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, PointerMatrix } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let pointers = PointerMatrix.create(2,3);
@@ -2265,7 +2330,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, UiDirection } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.fling(UiDirection.DOWN, 10000);
@@ -2303,7 +2369,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.screenCapture('/data/storage/el2/base/cache/1.png', {left: 0, top: 0, right: 100, bottom: 100});
@@ -2337,7 +2404,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver,MouseButton } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.mouseClick({x:248, y:194}, MouseButton.MOUSE_BUTTON_LEFT, 2072);
@@ -2372,7 +2440,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.mouseScroll({x:360, y:640}, true, 30, 2072)
@@ -2403,7 +2472,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
await driver.mouseMoveTo({x:100, y:100})
@@ -2434,7 +2504,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let observer = await driver.createUIEventObserver()
@@ -2468,7 +2539,8 @@ Creates a **PointerMatrix** object and returns the object created. This API is a
**Example**
-```js
+```ts
+import { PointerMatrix } from '@ohos.UiTest';
async function demo() {
let pointerMatrix = PointerMatrix.create(2,3);
}
@@ -2492,7 +2564,8 @@ Sets the coordinates for the action corresponding to the specified finger and st
**Example**
-```js
+```ts
+import { PointerMatrix } from '@ohos.UiTest';
async function demo() {
let pointers = PointerMatrix.create(2,3);
pointers.setPoint(0,0,{x:230,y:480});
@@ -2535,7 +2608,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2568,7 +2642,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2601,7 +2676,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2634,7 +2710,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2667,7 +2744,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2700,7 +2778,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2727,7 +2806,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2762,7 +2842,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2798,7 +2879,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver, ResizeDirection } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2826,7 +2908,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2854,7 +2937,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2882,7 +2966,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2910,7 +2995,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2938,7 +3024,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
**Example**
-```js
+```ts
+import { Driver } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let window = await driver.findWindow({actived: true});
@@ -2967,11 +3054,12 @@ Subscribes to events of the toast component. This API uses a callback to return
**Example**
-```js
+```ts
+import { Driver, UIElementInfo } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let observer = await driver.createUIEventObserver()
- let callback = (UIElementInfo)=>{
+ let callback = (UIElementInfo: UIElementInfo)=>{
console.info(UIElementInfo.bundleName)
console.info(UIElementInfo.text)
console.info(UIElementInfo.type)
@@ -2997,11 +3085,12 @@ Subscribes to events of the dialog component. This API uses a callback to return
**Example**
-```js
+```ts
+import { Driver, UIElementInfo } from '@ohos.UiTest';
async function demo() {
let driver = Driver.create();
let observer = await driver.createUIEventObserver()
- let callback = (UIElementInfo)=>{
+ let callback = (UIElementInfo: UIElementInfo)=>{
console.info(UIElementInfo.bundleName)
console.info(UIElementInfo.text)
console.info(UIElementInfo.type)
@@ -3024,7 +3113,8 @@ All APIs provided in the **By** class are synchronous. You are advised to use th
This class is deprecated since API version 9. You are advised to use [On9+](#on9) instead.
-```js
+```ts
+import { BY } from '@ohos.UiTest';
BY.text('123').type('button');
```
@@ -3053,7 +3143,8 @@ This API is deprecated since API version 9. You are advised to use [text9+<
**Example**
-```js
+```ts
+import { BY } from '@ohos.UiTest';
let by = BY.text('123'); // Use the static constructor BY to create a By object and specify the text attribute of the target component.
```
@@ -3082,7 +3173,8 @@ This API is deprecated since API version 9. You are advised to use [id9+9+<
**Example**
-```js
+```ts
+import { BY } from '@ohos.UiTest';
let by = BY.type('button'); // Use the static constructor BY to create a By object and specify the type attribute of the target component.
```
@@ -3169,7 +3263,8 @@ This API is deprecated since API version 9. You are advised to use [clickable
**Example**
-```js
+```ts
+import { BY } from '@ohos.UiTest';
let by = BY.enabled(true); // Use the static constructor BY to create a By object and specify the enabled status attribute of the target component.
```
@@ -3254,7 +3351,8 @@ This API is deprecated since API version 9. You are advised to use [focused
**Example**
-```js
+```ts
+import { BY } from '@ohos.UiTest';
let by = BY.focused(true); // Use the static constructor BY to create a By object and specify the focused status attribute of the target component.
```
@@ -3282,7 +3380,8 @@ This API is deprecated since API version 9. You are advised to use [selected
**Example**
-```js
+```ts
+import { BY } from '@ohos.UiTest';
let by = BY.isAfter(BY.text('123')); // Use the static constructor BY to create a By object, specifying that the target component is located after the given attribute component.
```
@@ -3362,7 +3463,8 @@ This API is deprecated since API version 9. You are advised to use [click9+
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let button = await driver.findComponent(BY.type('button'));
@@ -3382,7 +3484,8 @@ This API is deprecated since API version 9. You are advised to use [doubleClick<
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let button = await driver.findComponent(BY.type('button'));
@@ -3402,7 +3505,8 @@ This API is deprecated since API version 9. You are advised to use [longClick9+
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let button = await driver.findComponent(BY.type('button'));
@@ -3480,7 +3586,8 @@ This API is deprecated since API version 9. You are advised to use [getText
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let button = await driver.findComponent(BY.type('button'));
@@ -3506,7 +3613,8 @@ This API is deprecated since API version 9. You are advised to use [getType
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let button = await driver.findComponent(BY.type('button'));
@@ -3532,7 +3640,8 @@ This API is deprecated since API version 9. You are advised to use [isClickable<
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let button = await driver.findComponent(BY.type('button'));
@@ -3562,7 +3671,8 @@ This API is deprecated since API version 9. You are advised to use [isScrollable
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let scrollBar = await driver.findComponent(BY.scrollable(true));
@@ -3593,7 +3703,8 @@ This API is deprecated since API version 9. You are advised to use [isEnabled9
**Example**
-```js
+```ts
+import { UiDriver } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
}
@@ -3774,7 +3890,8 @@ This API is deprecated since API version 9. You are advised to use [delayMs
**Example**
-```js
+```ts
+import { UiDriver } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
await driver.delayMs(1000);
@@ -3805,7 +3922,8 @@ This API is deprecated since API version 9. You are advised to use [findComponen
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let button = await driver.findComponent(BY.text('next page'));
@@ -3836,7 +3954,8 @@ This API is deprecated since API version 9. You are advised to use [findComponen
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
let buttonList = await driver.findComponents(BY.text('next page'));
@@ -3859,9 +3978,19 @@ This API is deprecated since API version 9. You are advised to use [assertCompon
| ------ | ------------------- | ---- | -------------------- |
| by | [By](#bydeprecated) | Yes | Attributes of the target component.|
+**Error codes**
+
+For details about the error codes, see [UiTest Error Codes](../errorcodes/errorcode-uitest.md).
+
+| ID| Error Message |
+| -------- | ------------------------------------------------ |
+| 17000002 | if the async function was not called with await. |
+| 17000003 | if the assertion failed. |
+
**Example**
-```js
+```ts
+import { UiDriver, BY } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
await driver.assertComponentExist(BY.text('next page'));
@@ -3880,7 +4009,8 @@ This API is deprecated since API version 9. You are advised to use [pressBack9+
**Example**
-```js
+```ts
+import { UiDriver } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
await driver.click(100,100);
@@ -3958,7 +4090,8 @@ This API is deprecated since API version 9. You are advised to use [doubleClick<
**Example**
-```js
+```ts
+import { UiDriver } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
await driver.doubleClick(100,100);
@@ -3984,7 +4117,8 @@ This API is deprecated since API version 9. You are advised to use [longClick9+
**Example**
-```js
+```ts
+import { UiDriver } from '@ohos.UiTest';
async function demo() {
let driver = UiDriver.create();
await driver.swipe(100,100,200,200);
@@ -4043,7 +4178,8 @@ This API is deprecated since API version 9. You are advised to use [screenCapDefault value: **true** |
| alignment | [DialogAlignment](ts-methods-alert-dialog-box.md#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.
Default value: **DialogAlignment.Default**|
@@ -29,7 +29,7 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, aut
| openAnimation10+ | [AnimateParam](ts-explicit-animation.md#animateparam) | No | Parameters for defining the open animation of the dialog box.
**NOTE**
**iterations**: The default value is **1**, indicating that the animation is played once; any other value evaluates to the default value.
**playMode**: The default value is **PlayMode.Normal**; any other value evaluates to the default value.|
| closeAniamtion10+ | [AnimateParam](ts-explicit-animation.md#animateparam) | No | Parameters for defining the close animation of the dialog box.
**NOTE**
**iterations**: The default value is **1**, indicating that the animation is played once; any other value evaluates to the default value.
**playMode**: The default value is **PlayMode.Normal**; any other value evaluates to the default value. |
| showInSubWindow10+ | boolean | No | Whether to display a dialog box in a subwindow.
Default value: **false**, indicating that the dialog box is not displayed in the subwindow
**NOTE**
A dialog box whose **showInSubWindow** attribute is **true** cannot trigger the display of another dialog box whose **showInSubWindow** attribute is also **true**.|
-| backgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | No | Background color of the dialog box. |
+| backgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | No | Background color of the dialog box.
**NOTE**
If the content builder also has the background color set, the background color set here will be overridden by the background color of the content builder.|
| cornerRadius10+ | [BorderRadiuses](ts-types.md#borderradiuses9) \| [Dimension](ts-types.md#dimension10) | No | Radius of the rounded corners of the background.
You can set separate radiuses for the four rounded corners.
Default value: **{ topLeft: '24vp', topRight: '24vp', bottomLeft: '24vp', bottomRight: '24vp' }**
**NOTE**
This attribute must be used together with the [borderRadius](ts-universal-attributes-border.md) attribute.|
## CustomDialogController
@@ -110,7 +110,7 @@ struct CustomDialogUser {
}),
cancel: this.existApp,
autoCancel: true,
- alignment: DialogAlignment.Default,
+ alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
gridCount: 4,
customStyle: false,
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md
index 70097ad3815bc25cb0a14beb4595da46c5d924cb..9cfead3e4fd44d75c67af3427eda4da087a9d51b 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md
@@ -44,7 +44,7 @@ You can bind a popup to a component, specifying its content, interaction logic,
| ---------------------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| builder | [CustomBuilder](ts-types.md#custombuilder8) | Yes | Popup builder.
**NOTE**
The **popup** attribute is a universal attribute. A custom popup does not support display of another popup. The **position** attribute cannot be used for the first-layer container under the builder. If the **position** attribute is used, the popup will not be displayed. |
| placement | [Placement](ts-appendix-enums.md#placement8) | No | Preferred position of the popup. If the set position is insufficient for holding the popup, it will be automatically adjusted.
Default value: **Placement.Bottom**|
-| popupColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the popup. |
+| popupColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the popup.
Default value: **'#4d4d4d'**|
| enableArrow | boolean | No | Whether to display an arrow.
Since API version 9, if the position set for the popup is not large enough, the arrow will not be displayed. For example, if **placement** is set to **Left**, but the popup height (80 vp) is less than the sum of the arrow width (32 vp) and diameter of popup rounded corner (48 vp), the arrow will not be displayed.
Default value: **true**|
| autoCancel | boolean | No | Whether to automatically close the popup when an operation is performed on the page.
Default value: **true** |
| onStateChange | (event: { isVisible: boolean }) => void | No | Callback for the popup status change event.
**isVisible**: whether the popup is visible. |