material ui 中的涟漪影响用不同的颜色填充按钮

Ripple affect in material ui to fill up the button with a different color

我正在使用 material ui 进行反应。所以当用户点击按钮时(来自 material ui),可以看到涟漪效应,但很快就会消失,我希望涟漪效应用不同的颜色填充按钮.

请给出如何实现的建议。

谢谢。

检查 TouchRipple 组件的 code, it's got a prop called color. All material-ui components use the TouchRipple for the ripple effect. Now you want to control the color of this prop for Buttons. Material UI offers several different kinds of buttons. You can follow the code of the button you want to use, you'll notice they use EnhancedButton which then uses TouchRipple. EnhancedButton exposes a prop 调用 touchRippleColor,可用于指定波纹效果的颜色。