我不知道如何在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>