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

!20766 新增datepicker示例代码和截图

Merge pull request !20766 from sunjiakun/datepicker0711
......@@ -84,6 +84,9 @@ struct DatePickerExample {
end: new Date('2100-1-1'),
selected: this.selectedDate
})
.disappearTextStyle({color: Color.Gray, font: {size: '16fp', weight: FontWeight.Bold}})
.textStyle({color: '#ff182431', font: {size: '18fp', weight: FontWeight.Normal}})
.selectedTextStyle({color: '#ff0000FF', font: {size: '26fp', weight: FontWeight.Regular}})
.lunar(this.isLunar)
.onChange((value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
......@@ -95,4 +98,4 @@ struct DatePickerExample {
}
```
![datePicker](figures/datePicker.gif)
\ No newline at end of file
![datePicker](figures/DatePickerApi10.gif)
......@@ -51,6 +51,11 @@ struct DatePickerDialogExample {
start: new Date("2000-1-1"),
end: new Date("2100-12-31"),
selected: this.selectedDate,
showTime:true,
useMilitaryTime:false,
disappearTextStyle: {color: Color.Pink, font: {size: '22fp', weight: FontWeight.Bold}},
textStyle: {color: '#ff00ff00', font: {size: '18fp', weight: FontWeight.Normal}},
selectedTextStyle: {color: '#ff182431', font: {size: '14fp', weight: FontWeight.Regular}},
onAccept: (value: DatePickerResult) => {
// 通过Date的setFullYear方法设置按下确定按钮时的日期,这样当弹窗再次弹出时显示选中的是上一次确定的日期
this.selectedDate.setFullYear(value.year, value.month, value.day)
......@@ -73,6 +78,9 @@ struct DatePickerDialogExample {
end: new Date("2100-12-31"),
selected: this.selectedDate,
lunar: true,
disappearTextStyle: {color: Color.Pink, font: {size: '22fp', weight: FontWeight.Bold}},
textStyle: {color: '#ff00ff00', font: {size: '18fp', weight: FontWeight.Normal}},
selectedTextStyle: {color: '#ff182431', font: {size: '14fp', weight: FontWeight.Regular}},
onAccept: (value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info("DatePickerDialog:onAccept()" + JSON.stringify(value))
......@@ -90,4 +98,4 @@ struct DatePickerDialogExample {
}
```
![DataPickerDialog](figures/DataPickerDialog.gif)
![DataPickerDialog](figures/DatePickerDialogApi10.gif)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册