顯示包含訊息和按鈕的警示對話方塊。
適用於
模型導向應用程式
語法
context.navigation.openAlertDialog(alertStrings, options)
參數
| 參數名稱 | 類型 | 為必填項目 | Description |
|---|---|---|---|
| 警示字串 | AlertDialogStrings |
Yes | 要在警示對話方塊中使用的字串。 AlertDialogStrings 具有下列屬性: - 文字: string。 要在警示對話方塊中顯示的訊息。 - confirmButtonLabel: string。 確認按鈕標籤。 如果您未指定按鈕標籤,則會使用 OK (使用者慣用的語言) 作為按鈕標籤。 |
| options | AlertDialogOptions |
Yes | 對話方塊選項。 AlertDialogOptions 具有下列屬性: - 身高: number。 警示對話方塊的高度 (以像素為單位)。 - 寬度: 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";
}
);