要解决Angular 8中Material对话框的max-height属性不起作用的问题,可以尝试以下解决方法:
.mat-dialog-container {
max-height: 80vh !important; // 使用!important来确保样式优先级
}
.mat-dialog-container {
max-height: 80vh !important; // 使用!important来确保样式优先级
}
@import '~@angular/material/theming';
@include mat-core();
$my-theme-primary: mat-palette($mat-indigo);
$my-theme-accent: mat-palette($mat-pink, A200, A100, A400);
$my-theme: mat-light-theme($my-theme-primary, $my-theme-accent);
@include angular-material-theme($my-theme);
然后,在主题文件中添加对话框的自定义样式:
@import '~@angular/material/theming';
@include mat-core();
$dialog-max-height: 80vh; // 自定义属性
$my-theme-primary: mat-palette($mat-indigo);
$my-theme-accent: mat-palette($mat-pink, A200, A100, A400);
$my-theme: mat-light-theme($my-theme-primary, $my-theme-accent, $my-theme-warn);
$my-dialog-theme: (
'max-height': $dialog-max-height, // 添加对话框的自定义样式
);
$my-theme: map_merge($my-theme, ('dialog': $my-dialog-theme));
@include angular-material-theme($my-theme);
这些解决方法中的代码示例可以帮助您解决Angular 8中Material对话框的max-height属性不起作用的问题。您可以根据自己的需求选择其中一种方法来解决该问题。