如果为 mat-tab-group 设置了 [backgroundColor] 属性,则子控件的波纹效果会丢失

Ripple Effect is lost for child controls if [backgroundColor] Property is set for a mat-tab-group

如果为 mat-tab-group 设置了 [backgroundColor] 属性,子控件将失去波纹效果,是否有任何解决方法。?

Check this Stackblitz example to see the Issue

涟漪效应正在发挥作用,但我们无法看到它,因为 ripple color 是白色的。它采用白色,因为您已将 backgroundColor 设置为原色,并且您的原色是蓝色,前景为白色。波纹自动采用这种前景色。

有两种方法可以解决

  1. 通过为 matRippleColor 属性提供颜色,如果您的 backgroundColor 设置为深色,在您的情况下它是主要的并发出警告。

       <div class="div-style mat-elevation-z4" matRipple matRippleColor="rgba(0,0,0,.1)>Ripple</div>
    
    
  2. 通过设置灯光backgroundColor。在你的情况下它 accent.