0
我有一個列表,用戶可以從列表項目中調用彈出窗口。 在彈出窗口中,當選擇一個選項時,應該創建一個確認提醒。Ionic2 Alert不顯示彈出窗口是否處於活動狀態
問題是當我試圖在彈出窗口打開時調用警報時,它不能正確顯示。它似乎在名單後面,名單變得沒有響應(不能接受點擊了)...
對於測試建議,如果我直接從項目點擊添加警報,而不是從彈出窗口,警報顯示正確。
在其中的列表和酥料餅被創建的頁面:
public OnItemOptionsPress(event, item)
{
event.stopPropagation();
let popoverOptions =
[
{
Resource: "Remove",
Icon: "icon-trash",
Callback: (event, item) =>
{
this.confirmRemoveItem(event, item)
},
}
];
let popover = this.PopoverController.create
(
PopoverOptions,
{
Owner: item,
Items: this.popoverOptions
}
);
popover.present({ ev:event });
}
public confirmRemoveItem(event, item)
{
let alert = this.AlertController.create
(
{
title: 'Remove Item',
message: 'Do you want to remove?',
buttons:
[
{
text: 'No',
role: 'cancel',
handler:() =>
{
console.log('No has been clicked');
}
},
{
text: 'Yes',
handler:() =>
{
console.log('yes has been clicked');
this.removeItem(item);
}
}
]
}
);
alert.present();
}
public removeItem(item)
{
this.items.splice(item.Index, 1);
}
的酥料餅內的選項被選中時和關閉功能被稱爲:
public close(event, item)
{
if (item.Callback) item.Callback(event, this.Owner);
this.ViewController.dismiss();
}
您能否使用您的代碼創建[plunker](https://plnkr.co/edit/vEjjdH)演示程序? – sebaferreras