angularjs 甜蜜提示2:设置对话框高度

roejwanj  于 2022-10-31  发布在  Angular
关注(0)|答案(4)|浏览(138)

对于sweetAlert2,我注意到没有“height”属性,但有一个“width”属性,是否有办法将对话框的高度设置为80%?
谢谢
https://limonte.github.io/sweetalert2/

dxxyhpgq

dxxyhpgq1#

您必须使用自定义CSS类,如下面的代码片段所示:
第一个

to94eoyn

to94eoyn2#

自7.21.0版起,添加了一个修复程序。您可以添加选项“heightAuto:false”添加到“甜蜜提醒"选项,问题就解决了。

Swal.fire({
    heightAuto: false,
    title: 'Hello,
    Text: 'This is an alert'
});

示例如下:https://jsfiddle.net/y3nf3fjg/1/

ego6inou

ego6inou3#

对我来说,自定义SweetAlert的css的唯一方法是在全局样式.scss文件中覆盖它们(包括!important)。
失效日期:

.swal2-popup {
  font-size: 1em !important;
}
wnvonmuf

wnvonmuf4#

我正在使用Angular 。我从“高度:100%”更改为“高度:100vh”(在MainComponent.scss中)。此解决方案对我有效。

<body>
 <app-main>
 </app-main>
</body>

main.component.scss

:host
{height:100vh}

相关问题