reactjs - 使用 ButtonBase 在 Material UI TableRow 上产生波纹效果
问题描述
我希望为 Material UI Table 添加涟漪效果。我尝试了一大堆解决方案,但似乎没有一个能完美运行。他们都有自己的怪癖。
我确实找到了这篇文章,但没有在解决方案上投入太多精力。到目前为止,我的试验似乎可以带来可能的解决方案(希望如此)?我的表格行要么最终高度错误(并且不占用多列),要么最终奇怪地居中..不知道如何处理。
https://codesandbox.io/s/pmry2x11vj
<div className="App">
<Router>
<Grid container>
<Grid item xs={12}>
<Card>
<Table>
<TableBody>
<TableRow hover>
<TableCell>test</TableCell>
<TableCell>Property</TableCell>
</TableRow>
<TableRow
hover
component={Link}
to={"/"}
style={{ textDecoration: "none" }}
>
<TableCell>Other</TableCell>
<TableCell>Row</TableCell>
</TableRow>
<ButtonBase style={{ width: "100%", height: "100%" }}>
<TableRow
hover
component={Link}
to={"/"}
style={{ textDecoration: "none" }}
>
<TableCell>row</TableCell>
<TableCell>is weirdly centered</TableCell>
</TableRow>
</ButtonBase>
<ButtonBase style={{ width: "100%", height: "100%" }}>
<TableRow
hover
component={Link}
to={"/"}
style={{
textDecoration: "none",
width: "100%",
height: "100%"
}}
>
<TableCell>row</TableCell>
<TableCell>
not right height, missing space on right
</TableCell>
</TableRow>
</ButtonBase>
<TableRow
hover
component={Link}
to={"/"}
style={{
textDecoration: "none",
width: "100%",
height: "100%"
}}
>
<ButtonBase style={{ width: "100%", height: "100%" }}>
<TableCell>row</TableCell>
<TableCell>
not right height, missing space on left / right
</TableCell>
</ButtonBase>
</TableRow>
<TableRow>
<TableCell style={{ width: "100%", height: "100%" }}>
<ButtonBase style={{ width: "100%", height: "100%" }}>
Extra
</ButtonBase>
</TableCell>
<TableCell>Normal Row</TableCell>
</TableRow>
<TableRow>
<TableCell>Extra</TableCell>
<TableCell>Normal Row</TableCell>
</TableRow>
</TableBody>
</Table>
</Card>
</Grid>
</Grid>
</Router>
</div>
解决方案
推荐阅读
- javascript - 使用提示中的值作为 highcharts 导出文件名
- r - 添加列时分解
- c# - 从 WpfEmbeddedBrowser 中删除 Cookie - WPF
- rust - 为什么shiplift 0.6 中的类型说`std::future::Future` 不满足?
- r - 如何优化字符串检测以提高速度?
- javascript - 如何提取和使用从 cy.wrap() 返回的字符串值
- python - Python——数组()VS数组([])
- python - Tkinter:更改菜单栏和标题栏颜色
- excel - VBA excel宏 - 在按钮上方添加行
- django - 在 Django 中验证错误的最佳方法是什么?