Ionic4 - 如何在中心对齐警报按钮?

But*_*ess 3 ionic-framework angular ionic4

只是一个快速修复,但它如何使我的按钮居中?我正在使用“alertCtrl.create”

1

在警报离子文档页面中似乎也没有某种居中。

https://ionicframework.com/docs/api/alert-controller

 alertCtrl.create ({  
    header: 'Invalid Input',
    message: 'Please enter correct details',
    buttons: ['Okay']
}).then(alertElement => alertElement.present());
    return;
}
Run Code Online (Sandbox Code Playgroud)

Moh*_*opi 6

使用模式 md 到 ios 因为`mode='ios' 默认情况下我们有按钮在中心。

alertCtrl.create ({  
    header: 'Invalid Input',
    mode:'ios', //by default you will get the button in center
    message: 'Please enter correct details',
    buttons: ['Okay']
}).then(alertElement => alertElement.present());
    return;
}
Run Code Online (Sandbox Code Playgroud)