当我在页面上显示警报时,用户可以单击背景并提醒解雇。有没有办法让背景无法点击?
this.alert = this.alertController.create({
title: 'Error',
subTitle: "You lost connection !",
buttons: [ {
text: 'Refresh',
handler: () => {
if(!data){
this.alert.dismiss().then(() => {
this.alert = null;
});
}
}
}]
});
答案 0 :(得分:1)
在创建警报时,只需将enableBackdropDismiss选项设置为false即可。例如:
this.alert = this.alertController.create({
title: 'Error',
subTitle: "You lost connection !",
enableBackdropDismiss: false,
buttons: [ {
text: 'Refresh',
handler: () => {
if(!data){
this.alert.dismiss().then(() => {
this.alert = null;
});
}
}
}]
});
希望这对你有所帮助。感谢。