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

!20505 【3.2-Release】翻译完成 19371+19210+19400

Merge pull request !20505 from ester.zhou/C2-19318
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
The **\<Badge>** component is a container that can be attached to another component for tagging. The **\<Badge>** component is a container that can be attached to another component for tagging.
> **NOTE** > **NOTE**
> >
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -11,6 +11,9 @@ The **\<Badge>** component is a container that can be attached to another compon ...@@ -11,6 +11,9 @@ The **\<Badge>** component is a container that can be attached to another compon
This component supports only one child component. This component supports only one child component.
> **NOTE**
>
> Built-in components and custom components are allowed, with support for ([if/else](../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)) rendering control.
## APIs ## APIs
...@@ -22,12 +25,12 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -22,12 +25,12 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters** **Parameters**
| Name| Type| Mandatory| Default Value| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| count | number | Yes| - | Number of notifications.| | count | number | Yes| Number of notifications.<br>**NOTE**<br>If the value is less than or equal to 0, no badge is displayed.<br>Value range: [-2147483648, 2147483647]<br>If the value is not an integer, it is rounded off to the nearest integer. For example, 5.5 is rounded off to 5.|
| position | [BadgePosition](#badgeposition) | No| BadgePosition.RightTop | Position to display the badge relative to the parent component.| | position | [BadgePosition](#badgeposition) | No| Position to display the badge relative to the parent component.<br>Default value: **BadgePosition.RightTop**|
| maxCount | number | No| 99 | Maximum number of notifications. When the maximum number is reached, only **maxCount+** is displayed.| | maxCount | number | No| Maximum number of notifications. When the maximum number is reached, only **maxCount+** is displayed.<br>Default value: **99**<br>Value range: [-2147483648, 2147483647]<br>If the value is not an integer, it is rounded off to the nearest integer. For example, 5.5 is rounded off to 5.|
| style | [BadgeStyle](#badgestyle) | Yes| - | Style of the badge, including the font color, font size, badge color, and badge size.| | style | [BadgeStyle](#badgestyle) | Yes| Style of the badge, including the font color, font size, badge color, and badge size.|
**API 2**: Badge(value: {value: string, position?: BadgePosition, style: BadgeStyle}) **API 2**: Badge(value: {value: string, position?: BadgePosition, style: BadgeStyle})
...@@ -57,12 +60,19 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -57,12 +60,19 @@ Since API version 9, this API is supported in ArkTS widgets.
Since API version 9, this API is supported in ArkTS widgets. Since API version 9, this API is supported in ArkTS widgets.
| Name | Type | Mandatory| Default Value | Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------- | | ------------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| color | [ResourceColor](ts-types.md#resourcecolor) | No | Color.White | Font color. | | color | [ResourceColor](ts-types.md#resourcecolor) | No | Font color.<br>Default value: **Color.White** |
| fontSize | number \| string | No | 10 | Font size, in vp. | | fontSize | number \| string | No | Font size.<br>Default value: **10**<br>Unit: vp<br>**NOTE**<br>This parameter cannot be set in percentage.|
| badgeSize | number \| string | No | 16 | Badge size, in vp. This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.| | badgeSize | number \| string | No | Badge size.<br>Default value: **16**<br>Unit: vp<br>**NOTE**<br>This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.|
| badgeColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color.Red | Badge color. | | badgeColor | [ResourceColor](ts-types.md#resourcecolor) | No | Badge color.<br>Default value: **Color.Red** |
## Attributes
The [universal attributes](ts-universal-attributes-size.md) are supported.
## Events
The [universal events](ts-universal-events-click.md) are supported.
## Example ## Example
......
...@@ -4,7 +4,7 @@ A date picker dialog box is a dialog box that allows users to select a date from ...@@ -4,7 +4,7 @@ A date picker dialog box is a dialog box that allows users to select a date from
> **NOTE** > **NOTE**
> >
> The APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. > The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
## DatePickerDialog.show ## DatePickerDialog.show
...@@ -81,3 +81,5 @@ struct DatePickerDialogExample { ...@@ -81,3 +81,5 @@ struct DatePickerDialogExample {
} }
} }
``` ```
![DataPickerDialog](figures/DataPickerDialog.gif)
...@@ -43,27 +43,31 @@ struct TextPickerDialogExample { ...@@ -43,27 +43,31 @@ struct TextPickerDialogExample {
private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4', 'banana5'] private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4', 'banana5']
build() { build() {
Column() { Row() {
Button("TextPickerDialog") Column() {
.margin(20) Button("TextPickerDialog")
.onClick(() => { .margin(20)
TextPickerDialog.show({ .onClick(() => {
range: this.fruits, TextPickerDialog.show({
selected: this.select, range: this.fruits,
onAccept: (value: TextPickerResult) => { selected: this.select,
// Set select to the index of the item selected when the OK button is touched. In this way, when the text picker dialog box is displayed again, the selected item is the one last confirmed. onAccept: (value: TextPickerResult) => {
this.select = value.index // Set select to the index of the item selected when the OK button is touched. In this way, when the text picker dialog box is displayed again, the selected item is the one last confirmed.
console.info("TextPickerDialog:onAccept()" + JSON.stringify(value)) this.select = value.index
}, console.info("TextPickerDialog:onAccept()" + JSON.stringify(value))
onCancel: () => { },
console.info("TextPickerDialog:onCancel()") onCancel: () => {
}, console.info("TextPickerDialog:onCancel()")
onChange: (value: TextPickerResult) => { },
console.info("TextPickerDialog:onChange()" + JSON.stringify(value)) onChange: (value: TextPickerResult) => {
} console.info("TextPickerDialog:onChange()" + JSON.stringify(value))
}
})
}) })
}) }.width('100%')
}.width('100%') }.height('100%')
} }
} }
``` ```
![TextPickerDialog](figures/TextPickerDialog.gif)
...@@ -74,3 +74,5 @@ struct TimePickerDialogExample { ...@@ -74,3 +74,5 @@ struct TimePickerDialogExample {
} }
} }
``` ```
![TimetPickerDialog](figures/TimePickerDialog.gif)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册