Cdk virtual-scroll inside mat-select for mat-option

后端 未结 2 1135
臣服心动
臣服心动 2021-02-14 20:35

Has anyone been able to use virtual-scroll inside mat-select as shown below ?


    
        

        
2条回答
  •  独厮守ぢ
    2021-02-14 21:05

    The virtual scroll viewport needs a size in order to know, how big the scroll container must be. This can be done by specifying the [itemSize] property of and its height.

    In your example the height of one item is 48px. If you want to show five items at once, the container size would be 5 * 48 = 240:

    
        
            
                 
                    {{state}}
                
            
        
    
    

提交回复
热议问题