【发布时间】:2021-12-01 06:10:02
【问题描述】:
我不知道如何将水平滚动添加到 mat-chip-list。有任何想法吗?我认为它必须与覆盖 mat-chip-list-wrapper 的更改有关。
.search-container {
position: absolute;
top: 25px;
margin-left: 6%;
}
div.mat-chip-list-wrapper {
display: flex;
flex-wrap: nowrap;
.mat-chip {
flex: 0 0 auto;
}
}
.mat-icon {
vertical-align: middle;
}
<div class="search-container">
<mat-chip-list>
<mat-chip *ngFor="let $searchTerm of ($searchTerms | async)" [removable]="$searchTerm.removable" (removed)="removeSearchTerm(searchTerm)" [matTooltip]="searchTerm">
<mat-icon matSuffix>{{$searchTerm.icon}}</mat-icon>
{{$searchTerm.value}}
<mat-icon matChipRemove *ngIf="$searchTerm.removable">cancel</mat-icon>
</mat-chip>
</mat-chip-list>
<div class="search">
<mat-form-field floatLabel="never" class="remove-underline trim-whitespace">
<span matPrefix><mat-icon matSuffix>search</mat-icon></span>
<input matInput (keyup)="onSearchTerm($event)" placeholder="Search" [(ngModel)]="searchInput">
</mat-form-field>
<button mat-button (click)="submitSearchTerm()">Submit</button>
</div>
</div>
【问题讨论】: