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

!2192 1954 处理完成:ts-basic-components-datepicker.md 刷新

Merge pull request !2192 from ester.zhou/TR-1954
# DatePicker # DatePicker
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -13,7 +13,7 @@ The **<DatePicker>** component allows users to select date and time. ...@@ -13,7 +13,7 @@ The **<DatePicker>** component allows users to select date and time.
None None
## Child Component ## Child Components
None None
...@@ -25,42 +25,42 @@ DatePicker(value:{start?: Date, end?: Date, selected?: Date, type?: DatePickerTy ...@@ -25,42 +25,42 @@ DatePicker(value:{start?: Date, end?: Date, selected?: Date, type?: DatePickerTy
Creates a date picker that allows users to select a date or time within the specified range. Creates a date picker that allows users to select a date or time within the specified range.
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| start | Date | No | Date('1970-1-1') | Start date of the date picker. | | start | Date | No | Date('1970-1-1') | Start date of the date picker. |
| end | Date | No | Date('2100-12-31') | End date of the date picker. | | end | Date | No | Date('2100-12-31') | End date of the date picker. |
| selected | Date | No | Current system date or time | Selected date when **type** is set to **DatePickerType.Date** and selected time when **type** is set to **DatePickerType.Time**. | | selected | Date | No | Current system date or time | Selected date when **type** is set to **DatePickerType.Date** and selected time when **type** is set to **DatePickerType.Time**. |
| type | DatePickerType | No | DatePickerType.Date | Picker type, which can be date picker and time picker. The date picker is used by default. | | type | DatePickerType | No | DatePickerType.Date | Picker type, which can be date picker and time picker. The date picker is used by default. |
- DatePickerType enums - DatePickerType enums
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| Date | Date picker. | | Date | Date picker. |
| Time | Time picker. | | Time | Time picker. |
## Attributes ## Attributes
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| -------- | -------- | -------- |-------- | | -------- | -------- | -------- |-------- |
| lunar | boolean | false | Whether&nbsp;to&nbsp;display&nbsp;the&nbsp;lunar&nbsp;calendar.<br/>-&nbsp;**true**:&nbsp;The&nbsp;lunar&nbsp;calendar&nbsp;is&nbsp;displayed.<br/>-&nbsp;**false**:&nbsp;The&nbsp;lunar&nbsp;calendar&nbsp;is&nbsp;not&nbsp;displayed. | | lunar | boolean | false | Whether to display the lunar calendar.<br/>- **true**: The lunar calendar is displayed.<br/>- **false**: The lunar calendar is not displayed. |
| useMilitaryTime | boolean | false | Whether&nbsp;the&nbsp;display&nbsp;time&nbsp;is&nbsp;in&nbsp;24-hour&nbsp;format. | | useMilitaryTime | boolean | false | Whether the display time is in 24-hour format. The value cannot be dynamically modified. |
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| onChange(callback:&nbsp;(value:&nbsp;DatePickerResult)&nbsp;=&gt;&nbsp;void) | This&nbsp;event&nbsp;is&nbsp;triggered&nbsp;when&nbsp;a&nbsp;date&nbsp;or&nbsp;time&nbsp;is&nbsp;selected. | | onChange(callback: (value: DatePickerResult) =&gt; void) | This event is triggered when a date or time is selected. |
- DatePickerResult object description - DatePickerResult
| Name | Type | Description | | Name | Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| year | number | Year&nbsp;of&nbsp;the&nbsp;selected&nbsp;date&nbsp;(when&nbsp;**type**&nbsp;is&nbsp;**DatePickerType.Date**). | | year | number | Year of the selected date (when **type** is **DatePickerType.Date**). |
| month | number | Month&nbsp;of&nbsp;the&nbsp;selected&nbsp;date&nbsp;(when&nbsp;**type**&nbsp;is&nbsp;**DatePickerType.Date**). | | month | number | Month of the selected date (when **type** is **DatePickerType.Date**). |
| day | number | Date&nbsp;of&nbsp;the&nbsp;selected&nbsp;date&nbsp;(when&nbsp;**type**&nbsp;is&nbsp;**DatePickerType.Date**). | | day | number | Date of the selected date (when **type** is **DatePickerType.Date**). |
| hour | number | Hour&nbsp;portion&nbsp;of&nbsp;the&nbsp;selected&nbsp;time&nbsp;(when&nbsp;**type**&nbsp;is&nbsp;**DatePickerType.Time**). | | hour | number | Hour portion of the selected time (when **type** is **DatePickerType.Time**). |
| minute | number | Minute&nbsp;portion&nbsp;of&nbsp;the&nbsp;selected&nbsp;time&nbsp;(when&nbsp;**type**&nbsp;is&nbsp;**DatePickerType.Time**). | | minute | number | Minute portion of the selected time (when **type** is **DatePickerType.Time**). |
## Example ## Example
...@@ -92,8 +92,6 @@ struct DatePickerExample01 { ...@@ -92,8 +92,6 @@ struct DatePickerExample01 {
} }
``` ```
![en-us_image_0000001211898486](figures/en-us_image_0000001211898486.gif)
### Date Picker (Without Lunar Calendar) ### Date Picker (Without Lunar Calendar)
...@@ -121,7 +119,6 @@ struct DatePickerExample02 { ...@@ -121,7 +119,6 @@ struct DatePickerExample02 {
} }
``` ```
![en-us_image_0000001257138355](figures/en-us_image_0000001257138355.gif)
### Time Picker ### Time Picker
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册