簡體   English   中英

在多行 mat-select 上隱藏第二行

[英]Hide second line on a multi-line mat-select

我的任務是創建一個具有以下樣式的下拉菜單在此處輸入圖像描述

代碼是

<mat-select >
    <mat-option *ngFor="let type of source"
                style="min-height: 48px; line-height: normal; height: auto; padding: 10px 20px;" [value]="type.value">
        <div class="u-textSize14">{{type.displayName}}</div>
        <div class="u-textSize12">{{type.hint}}</div>
    </mat-option>
</mat-select>

當我 select 一個選項時,選中的項目顯示為

“Standard UrlDomainName.com”,有什么辦法可以在選擇項目時隱藏第二行/提示並使其僅在墊子 select 打開時出現

要自定義您選擇的選項,請在<mat-select>中使用<mat-select-trigger> > :

<mat-select [formControl]="foo">
    <mat-select-trigger>{{foo.value ? foo.value[0] : ''}}</mat-select-trigger>
    <mat-option *ngFor="let item of items" [value]="item.val">{{item.label}} - {{item.desc}}</mat-option>
</mat-select>

暫無
暫無

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

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