1.alert
1,实现j简单提示框,2秒钟之后消失
import { AlertController } from '@ionic/angular';
constructor(public alertController: AlertController) { }
async presentAlert() {
const alert = await this.alertController.create({
header: '提示',
message: 'This is an alert message.'
});
await alert.present();
setTimeout(()=>{
this.alertController.dismiss()
},2000)
}

2.alert提示框
import { AlertController } from '@ionic/angular';
constructor(public alertController: AlertController) { }
async presentAlert() {
const alert = await this.alertController.create({
header: '提示',
message: '确定关闭此次会话吗?',
buttons: ['确定']
});
await alert.present();
}

3.多按钮弹出框
async presentAlert() {
const alert = await this.alertController.create({
header: 'Alert',
subHeader: 'Subtitle',
message: 'This is an alert message.',
buttons: ['Cancel', 'Open Modal', 'Delete']
});
await alert.present();
}

4.confirm提示框
async presentAlertConfirm() {
const alert = await this.alertController.create({
header: 'Confirm!',
message: 'Message <strong>text</strong>!!!',
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'secondary',
handler: (blah) => {
console.log('Confirm Cancel: blah');
}
}, {
text: 'Okay',
handler: () => {
console.log('Confirm Okay');
}
}
]
});
await alert.present();
}
