警告弹窗
显示警告弹窗组件,可设置文本内容与响应回调。
使用
Button('点击警告')
.onClick(()=> {
AlertDialog.show(
{
title: '标题',
message: '内容',
autoCancel: true,
alignment: DialogAlignment.Center,
gridCount: 4,
offset: { dx: 0, dy: -20 },
primaryButton: {
value: '取消',
action: () => {
console.info('Callback when the first button is clicked')
}
},
secondaryButton: {
value: '确认',
action: () => {
console.info('Callback when the second button is clicked')
}
},
cancel: () => {
console.info('Closed callbacks')
}
}
)
}).backgroundColor(0x317aff)