1. 警告弹窗
AlertDialog.show({
message: "是否需要重新输入",
primaryButton: {
value: "取消",
action: () => {
console.log("取消了输入");
},
},
secondaryButton: {
value: "确定",
action: () => {
console.log("确认需要");
},
},
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -100 },
});
2. 选择类弹窗
2.1 日期
DatePickerDialog.show({
start: new Date("2023-01-01"),
selected: new Date(),
end: new Date(),
lunar: false,
onAccept: (value: DatePickerResult) => {
let year = value.year;
let month = value.month + 1;
let day = value.day;
console.log(`${year}-${month}-${day}`);
},
});
2.2 文本选择
TextPickerDialog.show({
range: ["1", "2"],
selected: 1,
onAccept: (result: TextPickerResult) => {
console.log(result.value);
},
onCancel: () => {
console.log("取消");
},
});