ion-alert-controller
Ionic4项目中我们可以使用Ionic4弹窗组件ion-alert-controller对项目进行布局。 ion-alert-controller官方文档地址:https://ionicframework.com/docs/api/alert-controllerAlert controllers programmatically control the alert component. Alerts can be created and dismissed from the alert controller. View the
async function presentAlert() {
const alertController = document.querySelector('ion-alert-controller');
await alertController.componentOnReady();
const alert = await alertController.create({
header: 'Alert',
subHeader: 'Subtitle',
message: 'This is an alert message.',
buttons: ['OK']
});
return await alert.present();
}
ion-alert-controller 内置方法(Methods)
create | |
---|---|
Description | Create an alert overlay with alert options. |
Signature | create(options: AlertOptions) => Promise |
dismiss | |
Description | Dismiss the open alert overlay. |
Signature | dismiss(data?: any, role?: string | undefined, id?: string | undefined) => Promise |
getTop | |
Description | Get the most recently opened alert overlay. |
Signature | getTop() => Promise |