我在一個使用角材料(版本15)元素的項目中工作,我得到了一些需要自定義mat-form-field的要求(需要更改背景顏色、顏色和填充等)。我拼命地尋找,但沒有得到任何解決辦法。請幫我在版本15中自定義mat-form-field。我知道如何定制到版本13,但以上不知道。任何答案都將是可觀的。
請看看我的代碼,它在版本12中運行得非常好。 some . component . html:-& gt;
<mat-form-field class="opaque">
<textarea matInput
#editUserPrompt
cdkTextareaAutosize cdkAutosizeMinRows="1" cdkAutosizeMaxRows="10"
formControlName="userQueryText"
(keydown)="onEditUserPromptKeyDown($event)"></textarea>
<button mat-icon-button matSuffix matTooltip="Send message" (click)="onEditSendClick()" [disabled]="!editForm.valid"><mat-icon>done</mat-icon></button>
<button mat-icon-button matSuffix matTooltip="Cancel" (click)="onEditCancelClick()"><mat-icon>close</mat-icon></button>
<mat-error>
{{ getErrorMessage(editForm, 'userQueryText') }}
</mat-error>
</mat-form-field>
some . component . scss:-& gt;
.mat-form-field-appearance-outline .mat-form-field-outline .mat-form-field-outline-start,
.mat-form-field-appearance-outline .mat-form-field-outline .mat-form-field-outline-end {
border: none !important;
background-color: blue;
border-radius: 4px;
}
.mat-form-field.mat-form-field.mat-form-field-appearance-outline > div.mat-form-field-wrapper > div.mat-form-field-flex > div.mat-form-field-infix {
padding: 0.1em 0.25em 0.9em 0.25em !important;
color: white;
}
.mat-form-field.mat-form-field.mat-form-field-appearance-outline > div.mat-form-field-wrapper > div.mat-form-field-flex > div.mat-form-field-infix > span.mat-form-field-label-wrapper {
top: -1.5em;
}
.mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label {
transform: translateY(-1.5em) scale(.1);
width: 133.33333%;
}