我在我的项目中使用自动完成组件,以及自动完成组件,我在组件中添加了一个按钮,用于添加新客户,如下图所示。
在这里,我想实现两件事:
1)即使在滚动之后我想使按钮固定(i,e添加新客户)。
2)我想降低滚动条的高度。我怎样才能做到这一点?这是分叉的stackblitz链接
1)使用position:sticky
:
.add-button{
position: sticky;
top: 0;
z-index: 2;
}
2)使用height
与.cdk-overlay-pane
::ng-deep
::ng-deep .cdk-overlay-pane{
height: 150px!important;}
见这里:https://stackblitz.com/edit/angular-9ao75y-fc23aj?file=app/autocomplete-filter-example.css