apidialog
message
查看 Markdown显示只带确认按钮的系统消息框。
显示只带确认按钮的系统消息框。
KSM.dialog.message(args: {
title: string;
message: string;
}): Promise<{ confirmed: boolean }>| Windows | Android | 权限 |
|---|---|---|
| 支持 | 支持 | dialog |
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
title | string | 是 | 对话框标题 |
message | string | 是 | 正文 |
| 字段 | 类型 | 说明 |
|---|---|---|
confirmed | boolean | 用户确认时为 true |
MB_OK | MB_ICONINFORMATION。AlertDialog。false。TIMEOUT,
系统对话框可能仍然存在,宿主会抑制迟到响应。const result = await KSM.dialog.message({
title: 'Kasumi',
message: '操作完成'
});
if (!result.confirmed) {
console.info('消息框未完成确认');
}| 错误 | 场景 |
|---|---|
普通 TypeError | title 或 message 不是字符串 |
PERMISSION_DENIED | dialog 权限不可用 |
NOT_SUPPORTED | 宿主没有配置对话框服务 |
TIMEOUT | 请求超过桥接层 10 秒超时 |
评论