MATLAB多通道信号MEMD去噪工具包:专注EEG/ECG与电磁监测数据滤波
2026/6/5 5:56:27
import { ConfirmDialog } from '@kit.ArkUI'; @Entry @Component struct Index { isChecked: boolean = false; dialogControllerCheckBox: CustomDialogController = new CustomDialogController({ builder: ConfirmDialog({ title: '文本标题', content: '文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本', // 勾选框选中状态 isChecked: this.isChecked, // 勾选框说明文本 checkTips: '禁止后不再提示', primaryButton: { value: '禁止', action: () => {}, }, secondaryButton: { value: '允许', action: () => { this.isChecked = false console.info('Callback when the second button is clicked') } }, onCheckedChange: () => { console.info('Callback when the checkbox is clicked') }, }), autoCancel: true, alignment: DialogAlignment.Bottom }) build() { Row() { Stack() { Column(){ Button("文本+勾选弹出框") .width(96) .height(40) .onClick(() => { this.dialogControllerCheckBox.open() }) } .margin({bottom: 300}) } .align(Alignment.Bottom) .width('100%') .height('100%') } .backgroundImageSize({ width: '100%', height: '100%' }) .height('100%') } }运行效果如图:
本示例实现带勾选框的文本确认弹窗:
| 参数名 | 作用 |
|---|---|
| title | 弹窗标题 |
| content | 文本内容,可长文本展示 |
| isChecked | 勾选框默认选中状态 |
| checkTips | 勾选框右侧说明文字 |
| onCheckedChange | 勾选状态变化回调 |
| primaryButton | 左侧按钮 |
| secondaryButton | 右侧按钮 |
| 参数名 | 作用 |
|---|---|
| autoCancel: true | 点击遮罩层自动关闭 |
| alignment: DialogAlignment.Bottom | 底部弹出 |
| 字段 | 作用 |
|---|---|
| value | 按钮文字 |
| action | 点击回调 |
导入
从@kit.ArkUI导入 ConfirmDialog。
状态管理isChecked: boolean控制勾选框选中状态。
弹窗控制器
使用CustomDialogController管理弹窗生命周期。
页面布局
按钮固定在页面底部,点击调用open()打开弹窗。
isChecked由@Prop装饰,支持外部状态同步。checkTips用于说明勾选含义,如“不再提示”“同意协议”等。onCheckedChange是官方推荐的勾选监听事件。autoCancel默认可点击遮罩关闭,提升交互体验。alignment支持 Bottom/Center/Top 等。如果这篇文章对你有帮助,欢迎点赞、收藏、关注,你的支持是持续创作的动力