中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
如何通过AlertDialog实现一个警告弹窗?
微信扫码分享
@Entry @Component struct Index { build() { Column() { Button('two button dialog') .onClick(() => { AlertDialog.show( { title: 'title', subtitle: 'subtitle', message: 'text', autoCancel: true, alignment: DialogAlignment.Bottom, gridCount: 4, offset: { dx: 0, dy: -20 }, primaryButton: { value: 'cancel', action: () => { console.info('Callback when the first button is clicked') } }, secondaryButton: { enabled: true, defaultFocus: true, style: DialogButtonStyle.HIGHLIGHT, value: 'ok', action: () => { console.info('Callback when the second button is clicked') } } } ) }).backgroundColor(0x317aff) } .width('100%') } }