簡體   English   中英

在 Angular 材質中的 mat-form-field 中隱藏箭頭

[英]Hide Arrows From mat-form-field in Angular Material

我正在使用mat-form-field輸入電話號碼。 這是我的基本代碼。

<mat-form-field class="full-width">
  <input matInput type="number" placeholder="Telefonnummer für Rückruf" value="" [(ngModel)]="this.inputValues.phone">
</mat-form-field>

順便說一句,當我將 hover 放在它上面時,這個組件會顯示箭頭/旋轉按鈕。

請讓我知道如何自定義此組件,使其不再顯示箭頭/旋轉按鈕。

親切的問候,傑

只要輸入類型為number ,就會出現箭頭/微調器。 它可以使用 css/scss 刪除。 鏈接提供示例和更多信息。

試試這個 css/scss 代碼:

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

當您將以下 CSS 代碼添加到style.css時,它應該被隱藏。

/* Chrome, Safari, Edge, Opera */
input[matinput]::-webkit-outer-spin-button,
input[matinput]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[matinput][type=number] {
  -moz-appearance: textfield;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM