# 10.7:TextPickerDialog
import { promptAction } from '@kit.ArkUI';
@Entry
@ComponentV2
struct Index {
build() {
Column({space: 10}) {
Button("TextPickerDialog")
.onClick(() => {
this.showTextPickerDialog()
})
}
.width('100%')
}
private showTextPickerDialog() {
let range: Array<string> = ["text1", "text2", "text3"]
let dialog: TextPickerDialogOptions = {
defaultPickerItemHeight: 50,
range: range,
canLoop: true,
shadow: {
radius: 10,
offsetX: 20,
offsetY: 20,
color: "#66333333"
},
onAccept: (date) => {
promptAction.showToast({message: "date: " + date.toString()})
}
}
TextPickerDialog.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版权所有,禁止私自转发、克隆网站。