mat-select long 选项值 [英] mat-select long option value

查看:29
本文介绍了mat-select long 选项值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理 mat-select 中的长值?

我可以添加水平滚动吗?
或者我可以将长选项值设为 2 行吗?

我尝试添加从

解决方案

将以下内容添加到您的 style.css 文件

.mat-option-text {溢出:自动;文本溢出:未设置;}

Stackblitz Demo 显示水平滚动条内选项

How can i handle long value in mat-select?

Can i add horizontal scroll?
or can i make the long option value to be 2 line?

i have tried add virtual-scroll class what i got from here, but i got error

<mat-select formControlName="fieldOfWork" placeholder="Pilih bidang pekerjaan"  class="virtual-scroll" required>
   <mat-option [value]="null">Pilih bidang pekerjaan</mat-option>
   <mat-option *ngFor="let fieldOfWork of fieldOfWorks" [value]="fieldOfWork?.value">
      {{fieldOfWork?.label}}
   </mat-option>
</mat-select>

How to Handle the following ?

解决方案

Add the following to your style.css file

.mat-option-text {
  overflow: auto;
  text-overflow: unset;
}

Stackblitz Demo showing horizontal Scroll bar inside option

这篇关于mat-select long 选项值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆