Ric*_*rro 18 typescript ionic2 ionic3 angular ionic4
我正在构建一个离子2应用程序,我正在使用以下组件
http://ionicframework.com/docs/components/#alert
import { AlertController } from 'ionic-angular';
export class MyPage {
constructor(public alertCtrl: AlertController) {
}
showAlert() {
let alert = this.alertCtrl.create({
title: 'New Friend!',
subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
buttons: ['OK']
});
alert.present();
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能确保当我在框外点击警报时不会被解雇?
seb*_*ras 42
正如您在AlertController文档中看到的,您可以enableBackdropDismiss在创建警报时使用(boolean)选项:
是否应该通过点击背景来解除警报.默认为true
import { AlertController } from 'ionic-angular';
// ...
export class MyPage {
constructor(public alertCtrl: AlertController) {}
showAlert() {
let alert = this.alertCtrl.create({
title: 'New Friend!',
subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
buttons: ['OK'],
enableBackdropDismiss: false // <- Here! :)
});
alert.present();
}
}
Run Code Online (Sandbox Code Playgroud)
Pet*_*ete 11
在ionic 4中,该选项已重命名为
backdropDismiss: false
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12676 次 |
| 最近记录: |