angular - ngx-perfect-scrollbar 可以用于有角度的材质元素吗?
问题描述
我想在 mat-autocomplete 元素上添加完美的滚动条。是否可以在角材料元素上添加 ngx 完美滚动条?
解决方案
这就是我添加它的方式,但由于某种原因,它在 Chrome 中有效,但在 Firefox 中却没有。如果我用 Firefox 检查元素并展开覆盖 div,那么滚动条也可以工作,但只有在我展开该节点之后。如果您找到解决方案,请告诉我。
<mat-form-field>
<mat-chip-list #chipList>
<mat-chip *ngFor="let item of itemsSelected"
[selectable]="true"
[removable]="true"
(removed)="remove(item)">
{{item}}
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
<input placeholder="{{placeholder | translate}}"
#itemInput
[formControl]="itemCtrl"
[matAutocomplete]="auto"
[matChipInputFor]="chipList"
[matChipInputAddOnBlur]="true">
</mat-chip-list>
<mat-autocomplete #auto="matAutocomplete"
(optionSelected)="selected($event)"
(opened)="matAutocompleteOpened()"
class="overflow-hidden">
<perfect-scrollbar>
<mat-option #matOption *ngFor="let item of filteredItems | async" [value]="item">
{{item}}
</mat-option>
</perfect-scrollbar>
</mat-autocomplete>
</mat-form-field>
和 CSS
.mat-autocomplete-panel.overflow-hidden {
overflow: hidden !important;
position: relative !important;
.ps__rail-y:hover {
background-color: transparent !important;
}
}
和
@Component({
------
encapsulation: ViewEncapsulation.None
})
推荐阅读
- python - 'DatabaseOperations' 对象没有属性 'geo_db_type
- react-native - React Native 中类似 Tinder 的滑动
- sql - 如何在 SQL 内联表值函数中返回所有可能的行
- paypal - 如何在 paypal Express CheckOut 中的 payment.create 中失败交易?
- javascript - 如何使用 ReactJs 获取当前用户
- swift - SwiftUI QR 码扫描带有边框角的反应角
- python - 根据当前用户组制作不可见字段(self.env.user.has_group 不起作用)Odoo 14
- java - 访问控制器映射的 URL 差异
- swift - 如何强制 ViewController 将 'b' 而不是 'a' 中的数据导出到下一个 VC?
- amazon-web-services - AWS ALB - 所有服务都单一?