Zon*_*mmm 4 css reactjs material-ui
我正在尝试在 Material-ui 中编辑表格,但我不想将其显示为卡片。我想删除整个表格周围的边框,但在文档页面上找不到有关删除边框的任何内容。有人可以帮我吗?
有关组件的链接: https: //material-ui.com/components/tables/#other
代码:
import React from 'react';
import { withStyles, Theme, createStyles, makeStyles } from '@material-ui/core/styles';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableContainer from '@material-ui/core/TableContainer';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import Paper from '@material-ui/core/Paper';
......
export default function CustomizedTables() {
const classes = useStyles();
return (
<TableContainer component={Paper}>
<Table className={classes.table} aria-label="customized table">
<TableHead>
<TableRow>
<StyledTableCell>Dessert (100g serving)</StyledTableCell>
<StyledTableCell align="right">Calories</StyledTableCell>
<StyledTableCell align="right">Fat (g)</StyledTableCell>
<StyledTableCell align="right">Carbs (g)</StyledTableCell>
<StyledTableCell align="right">Protein (g)</StyledTableCell>
</TableRow>
</TableHead>
<TableBody>
{rows.map((row) => (
<StyledTableRow key={row.name}>
<StyledTableCell component="th" scope="row">
{row.name}
</StyledTableCell>
<StyledTableCell align="right">{row.calories}</StyledTableCell>
<StyledTableCell align="right">{row.fat}</StyledTableCell>
<StyledTableCell align="right">{row.carbs}</StyledTableCell>
<StyledTableCell align="right">{row.protein}</StyledTableCell>
</StyledTableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
}
Run Code Online (Sandbox Code Playgroud)
使用(默认海拔)TableContainer作为Paper背景,这就是它像卡片一样显示的原因。删除该component={Paper}部分将删除这些类。
像这样使用它
<TableContainer >
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13298 次 |
| 最近记录: |