【发布时间】:2018-09-13 14:03:06
【问题描述】:
我遇到了“下拉”菜单宽度的材料垫选择初始选择框与垫选择面板中的选项大小相同的问题。我以前有一个简单的 jQuery 选择框,占位符有一个宽度,选择/选项有一个单独的宽度。它似乎是自动完成的。我现在在使用 Angular 6 材料选择不同宽度时遇到问题。我花了很长时间才弄清楚如何首先改变宽度。我终于改用了
角度 HTML:
<div id="selectionList">
<mat-form-field>
<mat select [ngclass]="{'selection-box-width' : true }" placeholder="Select an Option">
<mat-option *ngFor="let selection of selectionList">
Your {{selection.name}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
和SCSS的
.selection-box-width {
min-width: 512px;
max-width: none;
}
选择框 (mat-select) 始终与弹出窗口较高的 z-index (mat-select-panel) 具有相同的宽度。是否有办法改变宽度并使它们不同?
【问题讨论】:
标签: angular sass angular-material html-select