【发布时间】:2019-02-05 00:03:52
【问题描述】:
到目前为止,在 API (v3.9.2) 中,我看到提到 TouchRippleProps for ButtonBase for https://material-ui.com/api/button-base/
我的按钮看起来像
<Button variant="text"
size={"large"}
fullWidth
className={classes.button}
>
{value}
</Button>
我的按钮 style 是 .
button: {
backgroundColor: colors.surface,
borderRadius: 0, // to make buttons sharp edged
touchRipple: colors.primary
}
当我触摸一个按钮时,我看到一个白色背景(见编号5)
我的问题是,当我触摸按钮时,如何将背景从 white 更改为 blue,然后让它消失?
【问题讨论】:
-
复制此内容的 CodeSandbox 会有所帮助。
-
有很多方法可以解决这个问题,但从您的问题中不清楚是什么导致按钮变为白色背景以及它是否保持白色。由于这不是默认行为的一部分,因此显示当前行为的沙箱将更容易提供实际适用于您的其余样式的方法。
-
谢谢@RyanCogswell。代码沙箱是codesandbox.io/s/2ryy62zn0。但是,当您在浏览器窗口中打开它时,不会弹出问题,但是如果您在 Mobile 或 Mobile View 中打开它(打开 DevTools),您会看到此问题。演示网址是2ryy62zn0.codesandbox.io
-
我添加了基于来自代码框的2ryy62zn0.codesandbox.io URL 的更新视图。再次感谢您
标签: javascript reactjs material-ui