[英]How to show data In two line in mat-select?
在 mat-select 选项的字符串太长,选择的选项应该在同一个下拉列表中显示为两行。
现在字符串看起来不完整。
<mat-form-field class="form-field">
<mat-select formControlName="foo">
<mat-option value="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</mat-option>
</mat-select>
</mat-form-field>
我想要这样的东西
似乎有一些过时的答案。
从 Angular 材料 11 开始,您可以通过调整 mat-option 的 css 轻松做到这一点。
<mat-option class="multiline-mat-option">
<div>Line 1</div>
<div>Line 2</div>
</mat-option>
.multiline-mat-option.mat-option {
white-space: normal;
line-height: normal;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.