如何在禁用状态下自定义mat-form-field [英] How Can I customize mat-form-field in disabled state
本文介绍了如何在禁用状态下自定义mat-form-field的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试自定义角材的mat-form-field:我能够使用:
I am trying to customize the angular material mat-form-field : I was able to customize the underline border using :
::ng-deep.mat-form-field-ripple {
background-color: yellow;
}
现在我正在尝试将禁用状态下的下划线边框自定义为实线,而不是虚线:
now I am trying to customize the underline border in the disabled state to be solid instead of the dashed line :
我尝试过此操作,但对下划线不起作用:
I tried this but it didn't work for underline :
::ng-deep.mat-form-field-disabled
{
}
我希望它在禁用状态下呈灰色固体
I want this to be gray solid in disabled state
<mat-form-field>
<input matInput placeholder="Input" [disabled]='true'>
</mat-form-field>
推荐答案
此问题已解决:
::ng-deep.mat-form-field-disabled .mat-form-field-underline
{
background-image: linear-gradient( to right, rgba(0, 0, 0, 1) 0, rgba(0, 0, 0, 0.42) 33%, #c2c7cc 0 ) !important;
background-size: 1px 100% !important;
background-repeat: repeat-x !important;
}
这篇关于如何在禁用状态下自定义mat-form-field的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文