# 10.5:DatePickerDialog
import { promptAction } from '@kit.ArkUI';
@Entry
@ComponentV2
struct Index {
build() {
Column({space: 10}) {
Button("CalendarPickerDialog")
.onClick(() => {
this.showActionSheet()
})
}
.width('100%')
}
private showActionSheet() {
let dialog: DatePickerDialogOptions = {
selected: new Date(),
lunar: true,
lunarSwitch: true,
showTime: true,
shadow: {
radius: 10,
offsetX: 20,
offsetY: 20,
color: "#66333333"
},
onAccept: (date) => {
promptAction.showToast({message: "date: " + date.toString()})
}
}
DatePickerDialog.show(dialog)
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

请作者喝杯咖啡
©arkui.club版权所有,禁止私自转发、克隆网站。