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

!13316 翻译完成 12067+11838

Merge pull request !13316 from ester.zhou/TR-12067
......@@ -40,10 +40,10 @@ Creates an **Animator** object.
easing: 'friction',
delay: 0,
fill: 'forwards',
direction: "normal",
direction: 'normal',
iterations: 3,
begin: 200.0,
end: 400.0,
end: 400.0
};
animator.create(options);
```
......@@ -83,10 +83,10 @@ let options = {
easing: 'friction',
delay: 0,
fill: 'forwards',
direction: "normal",
direction: 'normal',
iterations: 3,
begin: 200.0,
end: 400.0,
end: 400.0
};
try {
animator.reset(options);
......@@ -283,7 +283,7 @@ export default {
easing: 'friction',
delay: 0,
fill: 'forwards',
direction: "normal",
direction: 'normal',
iterations: 2,
begin: 200.0,
end: 400.0
......@@ -516,7 +516,7 @@ let options = {
easing: 'friction',
delay: 0,
fill: 'forwards',
direction: "normal",
direction: 'normal',
iterations: 3,
begin: 200.0,
end: 400.0,
......
# Media Query
# @ohos.mediaquery
The **mediaquery** module provides different styles for different media types.
......@@ -14,64 +14,64 @@ import mediaquery from '@ohos.mediaquery'
```
## Required Permissions
None.
## mediaquery.matchMediaSync
matchMediaSync(condition: string): MediaQueryListener
Sets the media query criteria and returns the corresponding listening handle.
Sets the media query condition. This API returns the corresponding media query listener.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------------------------------------- |
| condition | string | Yes | Matching condition of a media event. For details, see [Syntax of Media Query Conditions](../../ui/ui-ts-layout-mediaquery.md#syntax-of-media-query-conditions).|
| condition | string | Yes | Media query condition. For details, see [Syntax of Media Query Conditions](../../ui/ui-ts-layout-mediaquery.md#syntax-of-media-query-conditions).|
**Return value**
| Type | Description |
| ------------------ | ---------------------- |
| MediaQueryListener | Listening handle to a media event, which is used to register or deregister the listening callback.|
| MediaQueryListener | Media query listener, which is used to register or deregister the listening callback.|
**Example**
```js
```js
let listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
```
```
## MediaQueryListener
Media query handle, including the first query result when the handle is applied for.
Implements the media query listener, including the first query result when the listener is applied for.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
### Attributes
| Name | Type | Readable | Writable | Description |
| ------- | ------- | ---- | ---- | ---------- |
| matches | boolean | Yes | No | Whether the match condition is met. |
| media | string | Yes | No | Matching condition of a media event.|
| Name | Type | Readable| Writable| Description |
| ------- | ------- | ---- | ---- | -------------------- |
| matches | boolean | Yes | No | Whether the media query condition is met. |
| media | string | Yes | No | Media query condition.|
### on
on(type: 'change', callback: Callback<MediaQueryResult>): void
Registers a callback with the corresponding query condition by using the handle. This callback is triggered when the media attributes change.
Registers the media query listener. The callback is triggered when the media attributes change.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ---------------- |
| type | string | Yes | Must enter the string **change**.|
| type | string | Yes | Listener type. The value is fixed at **'change'**.|
| callback | Callback<MediaQueryResult> | Yes | Callback registered with media query. |
**Example**
For details, see [off Example](#off).
......@@ -79,17 +79,19 @@ Registers a callback with the corresponding query condition by using the handle.
off(type: 'change', callback?: Callback<MediaQueryResult>): void
Deregisters a callback with the corresponding query condition by using the handle, so that no callback is triggered when the media attributes change.
Deregisters the media query listener, so that no callback is triggered when the media attributes change.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ----------------------------- |
| type | boolean | Yes | Must enter the string **change**. |
| callback | Callback<MediaQueryResult> | No | Callback to be deregistered. If the default value is used, all callbacks of the handle are deregistered.|
| Name | Type | Mandatory| Description |
| -------- | -------------------------------- | ---- | ---------------------------------------------------------- |
| type | string | Yes | Listener type. The value is fixed at **'change'**. |
| callback | Callback<MediaQueryResult> | No | Callback to be deregistered. If the default value is used, all callbacks of the handle are deregistered.|
**Example**
```js
import mediaquery from '@ohos.mediaquery'
......@@ -101,20 +103,23 @@ Deregisters a callback with the corresponding query condition by using the handl
// do something here
}
}
listener.on('change', onPortrait) // Register a callback.
listener.off('change', onPortrait) // Deregister a callback.
listener.on('change', onPortrait) // Register the media query listener.
listener.off('change', onPortrait) // Deregister the media query listener.
```
## MediaQueryResult
Provides the media query result.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
### Attributes
| Name | Type | Readable | Writable | Description |
| ------- | ------- | ---- | ---- | ---------- |
| matches | boolean | Yes | No | Whether the match condition is met. |
| media | string | Yes | No | Matching condition of a media event.|
| Name | Type | Readable| Writable| Description |
| ------- | ------- | ---- | ---- | -------------------- |
| matches | boolean | Yes | No | Whether the media query condition is met. |
| media | string | Yes | No | Media query condition.|
### Example
......
# Prompt
# @ohos.prompt
The **Prompt** module provides APIs for creating and showing toasts, dialog boxes, and action menus.
......@@ -146,11 +146,11 @@ Describes the options for showing the dialog box.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------------------- |
| title | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup> | No | Title of the dialog box. |
| message | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup> | No | Text body. |
| buttons | Array | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. Up to three buttons are supported. The first button is of the **positiveButton** type, the second is of the **negativeButton** type, and the third is of the **neutralButton** type.|
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| title | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup> | No | Title of the dialog box. |
| message | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup> | No | Text body. |
| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?] | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. Up to three buttons are supported. The first button is of the **positiveButton** type, the second is of the **negativeButton** type, and the third is of the **neutralButton** type.|
## ShowDialogSuccessResponse
......@@ -158,9 +158,9 @@ Describes the dialog box response result.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Description |
| ----- | ------ | ------------------- |
| index | number | Index of the selected button in the **buttons** array.|
| Name | Type | Mandatory| Description |
| ----- | ------ | ---- | ------------------------------- |
| index | number | No | Index of the selected button in the **buttons** array.|
## prompt.showActionMenu
......@@ -255,10 +255,10 @@ Describes the options for showing the action menu.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------------------- |
| title | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup> | No | Title of the text to display. |
| buttons | Array&lt;[Button](#button)&gt; | Yes | Array of menu item buttons. The array structure is **{text:'button', color: '\#666666'}**. Up to six buttons are supported. If there are more than six buttons, extra buttons will not be displayed.|
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| title | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup> | No | Title of the text to display. |
| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?] | Yes | Array of menu item buttons. The array structure is **{text:'button', color: '\#666666'}**. Up to six buttons are supported. If there are more than six buttons, extra buttons will not be displayed.|
## ActionMenuSuccessResponse
......
# Prompt
# @ohos.promptAction
The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus.
......@@ -32,7 +32,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message|
| --------- | ------- |
| 100001 | Internal error. |
| 100001 | If UI execution context not found. |
**Example**
......@@ -88,7 +88,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message|
| --------- | ------- |
| 100001 | Internal error. |
| 100001 | If UI execution context not found. |
**Example**
......@@ -142,7 +142,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message|
| --------- | ------- |
| 100001 | Internal error. |
| 100001 | If UI execution context not found. |
**Example**
......@@ -181,11 +181,11 @@ Describes the options for showing the dialog box.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------------------- |
| title | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup>| No | Title of the dialog box. |
| message | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup>| No | Text body. |
| buttons | Array | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. Up to three buttons are supported. The first button is of the **positiveButton** type, the second is of the **negativeButton** type, and the third is of the **neutralButton** type.|
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| title | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup>| No | Title of the dialog box. |
| message | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup>| No | Text body. |
| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?] | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. Up to three buttons are supported. The first button is of the **positiveButton** type, the second is of the **negativeButton** type, and the third is of the **neutralButton** type.|
## ShowDialogSuccessResponse
......@@ -193,9 +193,9 @@ Describes the dialog box response result.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Description |
| ----- | ------ | ------------------- |
| index | number | Index of the selected button in the **buttons** array.|
| Name | Type | Mandatory| Description |
| ----- | ------ | ---- | ------------------------------- |
| index | number | No | Index of the selected button in the **buttons** array.|
## promptAction.showActionMenu
......@@ -218,7 +218,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message|
| --------- | ------- |
| 100001 | Internal error. |
| 100001 | If UI execution context not found. |
**Example**
......@@ -276,7 +276,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message|
| --------- | ------- |
| 100001 | Internal error. |
| 100001 | If UI execution context not found. |
**Example**
......@@ -314,10 +314,10 @@ Describes the options for showing the action menu.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------------------- |
| title | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup>| No | Title of the dialog box. |
| buttons | Array&lt;[Button](#button)&gt; | Yes | Array of menu item buttons. The array structure is **{text:'button', color: '\#666666'}**. Up to six buttons are supported. If there are more than six buttons, extra buttons will not be displayed.|
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| title | string\| [Resource](../arkui-ts/ts-types.md#resource)<sup>9+</sup>| No | Title of the dialog box. |
| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?] | Yes | Array of menu item buttons. The array structure is **{text:'button', color: '\#666666'}**. Up to six buttons are supported. If there are more than six buttons, extra buttons will not be displayed.|
## ActionMenuSuccessResponse
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册