显示包含消息和按钮的警报对话框。
适用于
模型驱动应用
Syntax
context.navigation.openAlertDialog(alertStrings, options)
参数
| 参数名称 | 类型 | 必选 | Description |
|---|---|---|---|
| alertStrings | AlertDialogStrings |
是的 | 要用于警报对话框的字符串。 AlertDialogStrings 具有以下属性: - text: string. 要显示在警报对话框中的消息。 - confirmButtonLabel: string. 确认按钮标签。 如果未指定按钮标签, 则确定 (以用户的首选语言)用作按钮标签。 |
| options | AlertDialogOptions |
是的 | 对话框选项。 AlertDialogOptions 具有以下属性: - height: number. 警报对话框的高度(以像素为单位)。 - width: number. 警报对话框的宽度(以像素为单位) |
返回值
类型:Promise
注解
Example
context.navigation.openAlertDialog({text:"This is an alert.", confirmButtonLabel : "Yes",}).then(
function success()
{
document.getElementById("openAlertDialogButton")!.innerHTML = "Alert dialog closed";
},
function()
{
document.getElementById("openAlertDialogButton")!.innerHTML = "Error in Alert Dialog";
}
);