如何在自动完成组件中设置滚动条的最大高度

问题描述 投票:1回答:1

我在我的项目中使用自动完成组件,以及自动完成组件,我在组件中添加了一个按钮,用于添加新客户,如下图所示。 enter image description here

在这里,我想实现两件事:

1)即使在滚动之后我想使按钮固定(i,e添加新客户)。

2)我想降低滚动条的高度。我怎样才能做到这一点?这是分叉的stackblitz链接

angular angular-material
1个回答
1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.