如何在angular中使用sweetalert自定义警报框的高度?
我正在使用SweetAlert在我的angular应用程序中显示警报框。一切正常,但我无法设置警报框的高度。可以选择设置警报框的宽度,但没有设置高度。我在函数中使用了如下代码:如何在angular中使用sweetalert自定义警报框的高度?,angular,sweetalert,Angular,Sweetalert,我正在使用SweetAlert在我的angular应用程序中显示警报框。一切正常,但我无法设置警报框的高度。可以选择设置警报框的宽度,但没有设置高度。我在函数中使用了如下代码: showSuccessAlert() { Swal.fire({ position: 'bottom-right', icon: 'success', title: 'Success!!!', showConfirmButton: true, widt
showSuccessAlert() {
Swal.fire({
position: 'bottom-right',
icon: 'success',
title: 'Success!!!',
showConfirmButton: true,
width: '400px'
});
}
如何根据我的需要设置警报框的高度?您可以将自定义类应用于警报的不同部分,来自
SweetAlertOptions
的不同部分包括:
* Swal.fire({
* customClass: {
* container: '...',
* popup: '...',
* title: '...',
* closeButton: '...',
* icon: '...',
* image: '...',
* input: '...',
* inputLabel: '...',
* validationMessage: '...',
* actions: '...',
* confirmButton: '...',
* denyButton: '...',
* cancelButton: '...',
* loader: '...',
* footer: '...'
* }
* })
所以你可以让一门课
.large-sa-popup {
height: {YOUR_HEIGHT_HERE}px
}
只需将其应用于弹出窗口,如:
showSuccessAlert() {
Swal.fire({
position: 'bottom-right',
icon: 'success',
title: 'Success!!!',
showConfirmButton: true,
width: '400px',
customClass: {
popup: 'large-sa-popup'
}
});
}
这将应用新的高度(以及您可能想要应用的任何其他CSS属性)