angular - 如何增加垫子菜单项的宽度?
问题描述
<div fxHide fxHide.xs="false" fxHide.md="true">
<button mat-icon-button [matMenuTriggerFor]="menu" class="my-menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item *ngFor="let menu of repoService.toolbarMenu" class="mr-4" (click)="repoService.onToolbarClick(menu)"
class="notifications-dropdown">
<mat-icon *ngIf="menu.icon" aria-label="menu.key" class="mr-4">{{menu.icon}}</mat-icon>
<span class="notification-row">{{menu.displayKey | translate}}</span>
</button>
</mat-menu>
CSS文件
.mat-menu-panel.notifications-dropdown {
max-width:none;
width: 100vw;
margin-left: -8px;
margin-top: 24px;
overflow: visible;
}
.notification-row{
width: 424px;
}
我已经尝试过了,但它对我不起作用!
解决方案
我有同样的问题,并通过覆盖 mat-menu-panel 最大宽度属性来解决它:
::ng-deep.mat-menu-panel {
max-width: none !important;
}
希望能帮助到你
推荐阅读
- python - 约束可以利用 groupby (pivot) 功能吗?(scipy.optimize.minimize;SLSQP)
- r - ifelse 带有可能的字符串匹配列表,没有其他
- c - 在函数 C 中返回“char *tab[]”
- database - ValueError:在可以使用这种多对多关系之前,变量需要具有字段“id”的值 - Django
- c# - EF Plus IncludeFilter 不会重置
- grails - 无法解析类 grails.plugin.multitenant.core.util.TenantUtils - Grails 2.3.11
- c - 空气中声速的C程序没有给出正确的结果
- c# - C# Unity 3D每次完整旋转添加点
- webpack-4 - 如何使用 vue cli 3 将多个组件中的 css 提取到单个文件中?
- ios - 在 App Store 上发布 NativeScript 应用程序时发生 CFBundleIdentifier 冲突等