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

!6820 翻译完成 6780

Merge pull request !6820 from ester.zhou/C1-0714
...@@ -15,7 +15,7 @@ ohos.permission.INTERNET (to use Internet images) ...@@ -15,7 +15,7 @@ ohos.permission.INTERNET (to use Internet images)
## Child Components ## Child Components
None Not supported
## APIs ## APIs
...@@ -25,15 +25,15 @@ Image(src: string | PixelMap | Resource) ...@@ -25,15 +25,15 @@ Image(src: string | PixelMap | Resource)
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7)\| [Resource](../../ui/ts-types.md#resource-type) | Yes | - | Image address, which can be the address of an Internet or a local image.<br/>When using resources referenced using a relative path, for example, `Image("common/test.jpg")`, the **\<Image>** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.<br>\- The following image formats are supported: png, jpg, bmp, svg, gif.<br/>\- Base64 strings are supported. The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string. <br/>\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability. | | src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7)\| [Resource](../../ui/ts-types.md#resource-type) | Yes | - | Image address, which can be the address of an Internet or a local image.<br/>When using resources referenced using a relative path, for example, `Image("common/test.jpg")`, the **\<Image>** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.<br>\- The following image formats are supported: png, jpg, bmp, svg, gif.<br/>\- Base64 strings are supported. The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string. <br/>\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability. |
## Attributes ## Attributes
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| alt | string | - | Placeholder image displayed during loading. Both local and Internal URIs are supported. | | alt | string \| [Resource](../../ui/ts-types.md#resource-type) | - | Placeholder image displayed during loading. Both local and Internal URIs are supported. |
| objectFit | ImageFit | ImageFit.Cover | Image scale type. | | objectFit | ImageFit | Cover | Image scale type. |
| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat-enums) | ImageRepeat.NoRepeat | Whether the image is repeated.<br/>**NOTE**<br/>This attribute is not applicable to SVG images. | | objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat-enums) | ImageRepeat.NoRepeat | Whether the image is repeated.<br/>**NOTE**<br/>This attribute is not applicable to SVG images. |
| interpolation | ImageInterpolation | None | Interpolation effect of the image. This attribute is valid only when the image is zoomed in.<br/>**NOTE**<br/>- This attribute is not applicable to SVG images.<br/>- This attribute is not applicable to a **PixelMap** object. | | interpolation | ImageInterpolation | None | Interpolation effect of the image. This attribute is valid only when the image is zoomed in.<br/>**NOTE**<br/>- This attribute is not applicable to SVG images.<br/>- This attribute is not applicable to a **PixelMap** object. |
| renderMode | ImageRenderMode | Original | Rendering mode of the image.<br/>**NOTE**<br/>This attribute is not applicable to SVG images. | | renderMode | ImageRenderMode | Original | Rendering mode of the image.<br/>**NOTE**<br/>This attribute is not applicable to SVG images. |
......
# Alert Dialog Box # Alert Dialog Box
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**
>
> This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
You can set the text content and response callback for an alert dialog box. The **<AlertDialog\>** component is used to display an alert dialog box. You can set the text content and response callback for an alert dialog box as needed.
## Attributes ## Attributes
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| show | options: { paramObject1\| paramObject2} | - | Defines and displays the **&lt;AlertDialog&gt;** component. | | show | options: { paramObject1 \| paramObject2} | - | Defines and displays the **<AlertDialog\>** component. |
- paramObject1 parameters - paramObject1 parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| title | string \|[Resource](../../ui/ts-types.md#resource) | | | Title of a dialog box. | | title | string \| [Resource](../../ui/ts-types.md#resource-type) | No | - | Title of a dialog box. |
| message | string \|[Resource](../../ui/ts-types.md#resource) | | | Content of the dialog box. | | message | string \| [Resource](../../ui/ts-types.md#resource-type) | Yes | - | Content of the dialog box. |
| autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. | | autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. |
| confirm | {<br/>value: string \|[Resource](../../ui/ts-types.md#resource),<br>fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),<br/>backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),<br>action: () =&gt; void<br/>} <br/> | | | Text content, text color, background color, and click callback of the confirm button. | | confirm | {<br/>value: string \| [Resource](../../ui/ts-types.md#resource-type),<br>fontColor?: Color\| number \| string \| [Resource](../../ui/ts-types.md),<br/>backgroundColor?:Color \| number \| string \| [Resource](../../ui/ts-types.md),<br>action: () =&gt; void<br/>} <br/> | No | - | Text content, text color, background color, and click callback of the confirm button. |
| cancel | () =&gt; void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. | | cancel | () =&gt; void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. |
| alignment | DialogAlignment | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md) | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. |
| offset | {<br/>dx: Length \|[Resource](../../ui/ts-types.md#resource),<br/>dy: Length \|[Resource](../../ui/ts-types.md#resource)<br/>} | | | Offset of the dialog box relative to the alignment position. | | offset | {<br/>dx: Length \| [Resource](../../ui/ts-types.md#resource-type),<br/>dy: Length \| [Resource](../../ui/ts-types.md)<br/>} | No | - | Offset of the dialog box relative to the alignment position. |
| gridCount | number | No | - | Number of grid columns occupied by the width of the dialog box. | | gridCount | number | No | - | Number of grid columns occupied by the width of the dialog box. |
- paramObject2 parameters - paramObject2 parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| title | string \|[Resource](../../ui/ts-types.md#resource) | No | - | Title of a dialog box. | | title | string \| [Resource](../../ui/ts-types.md#resource-type) | No | - | Title of a dialog box. |
| message | string \|[Resource](../../ui/ts-types.md#resource) | Yes | - | Content of the dialog box. | | message | string \| [Resource](../../ui/ts-types.md#resource-type) | Yes | - | Content of the dialog box. |
| autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. | | autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. |
| primaryButton | {<br/>value: string \|[Resource](../../ui/ts-types.md#resource),<br>fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),<br/>backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),<br>action: () =&gt; void<br/>} <br/> | | | Text content, text color, background color, and click callback of the primary button. | | primaryButton | {<br/>value: string \| [Resource](../../ui/ts-types.md#resource-type),<br>fontColor?: Color \| number \| string \| [Resource](../../ui/ts-types.md),<br/>backgroundColor?:Color \| number\| string\| [Resource](../../ui/ts-types.md),<br>action: () =&gt; void<br/>} <br/> | No | - | Text content, text color, background color, and click callback of the primary button. |
| secondaryButton | {<br/>value: string \|[Resource](../../ui/ts-types.md#resource),<br>fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),<br/>backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),<br>action: () =&gt; void<br/>} <br/> | | | Text content, text color, background color, and click callback of the secondary button. | | secondaryButton | {<br/>value: string \|[Resource](../../ui/ts-types.md#resource-type),<br>fontColor?: Color \| number \| string \| [Resource](../../ui/ts-types.md),<br/>backgroundColor?:Color \| number\| string\| [Resource](../../ui/ts-types.md),<br>action: () =&gt; void<br/>} <br/> | No | - | Text content, text color, background color, and click callback of the secondary button. |
| cancel | () =&gt; void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. | | cancel | () =&gt; void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. |
| alignment | DialogAlignment | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md) | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. |
| offset | {<br/>dx: Length \|[Resource](../../ui/ts-types.md#resource),<br/>dy: Length \|[Resource](../../ui/ts-types.md#resource)<br/>} | | | Offset of the dialog box relative to the alignment position. | | offset | {<br/>dx: Length \| [Resource](../../ui/ts-types.md#resource-type),<br/>dy: Length \| [Resource](../../ui/ts-types.md#resource-type)<br/>} | No | - | Offset of the dialog box relative to the alignment position. |
| gridCount | number | No | - | Number of grid columns occupied by the width of the dialog box. | | gridCount | number | No | - | Number of grid columns occupied by the width of the dialog box. |
## Example ## Example
``` ```ts
// xxx.ets
@Entry @Entry
@Component @Component
struct AlertDialogExample { struct AlertDialogExample {
......
# Touch Event # Touch Event
A touch event is triggered when a finger is pressed, slides, or is lifted from a component.
> **NOTE** > **NOTE**
> >
...@@ -13,49 +14,51 @@ None ...@@ -13,49 +14,51 @@ None
## Events ## Events
| Name | Bubbling Supported | Description | | Name | Bubbling Supported| Description |
| -------- | -------- | -------- | | ---------------------------------------- | ---- | ---------------------------------------- |
| onTouch(callback: (event?: TouchEvent) =&gt; void) | Yes | Invoked when a touch action is triggered. For details about **event**, see [TouchEvent](#touchevent). | | onTouch(callback:&nbsp;(event?:&nbsp;TouchEvent)&nbsp;=&gt;&nbsp;void) | Yes | Invoked when a touch action is triggered. For details about **event**, see [TouchEvent](#touchevent).|
## TouchEvent ## TouchEvent
- Attributes - Attributes
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | ------------------- | ---------------------------------------- | ------------ |
| type | TouchType | Type of a touch event. | | type | TouchType | Type of the touch event. |
| touches | Array&lt;[TouchObject](#touchobject)&gt; | All finger information. | | touches | Array&lt;[TouchObject](#touchobject)&gt; | All finger information. |
| changedTouches | Array&lt;[TouchObject](#touchobject)&gt; | Finger information changed. | | changedTouches | Array&lt;[TouchObject](#touchobject)&gt; | Finger information changed.|
| timestamp | number | Timestamp of the event. | | timestamp | number | Timestamp of the event. |
| target<sup>8+</sup> | [EventTarget](ts-universal-events-click.md#eventtarget8) | Target of the event. | | target<sup>8+</sup> | [EventTarget](ts-universal-events-click.md#eventtarget8) | Target of the event. |
- APIs - APIs
| API | Description | | Name | Description |
| -------- | -------- | | ---------------------- | ------- |
| stopPropagation(): void | Bubbling of the stop event. | | stopPropagation(): void| Stops the event from bubbling upwards or downwards.|
## TouchObject ## TouchObject
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | ------- | --------------------------- | ------------------- |
| type | [TouchType](#touchtype) | Type of a touch event. | | type | [TouchType](#touchtype-enums) | Type of the touch event. |
| id | number | Unique identifier of a finger. | | id | number | Unique identifier of a finger. |
| screenX | number | X coordinate of the touch point relative to the left edge of the screen. | | screenX | number | X-coordinate of the touch point relative to the left edge of the screen. |
| screenY | number | Y coordinate of the touch point relative to the upper edge of the device screen. | | screenY | number | Y-coordinate of the touch point relative to the upper edge of the device screen. |
| x | number | X coordinate of the touch point relative to the left edge of the element to touch. | | x | number | X-coordinate of the touch point relative to the left edge of the element being touched. |
| y | number | Y coordinate of the touch point relative to the upper edge of the element to touch. | | y | number | Y-coordinate of the touch point relative to the upper edge of the element being touched. |
## TouchType
| Name | Description |
| -------- | -------- |
| Down | Trigger a touch event when a finger is pressed. |
| Up | Trigger a touch event when a finger is lifted. |
| Move | Trigger a touch event when a finger moves on the screen in pressed state. |
| Cancel | Trigger an event when a touch event is canceled. |
## Example ## TouchType Enums
| Name | Description |
| ------ | --------------- |
| Down | A finger is pressed. |
| Up | A finger is lifted. |
| Move | A finger moves on the screen in pressed state.|
| Cancel | A touch event is canceled. |
## Example
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
......
...@@ -62,7 +62,7 @@ struct ComponentA { ...@@ -62,7 +62,7 @@ struct ComponentA {
@StorageProp('languageCode') lang: string = 'en' @StorageProp('languageCode') lang: string = 'en'
private label: string = 'count' private label: string = 'count'
private aboutToAppear() { aboutToAppear() {
this.label = (this.lang === 'en') ? 'Number' : 'Count' this.label = (this.lang === 'en') ? 'Number' : 'Count'
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册