Reactjs 如何在材质UI图纸元素上居中放置表格 我的问题是,我试图把固定大小的表放在页面中间(在一个纸组件中),失败得很惨。我在材质ui方面也很新,所以我不确定这是否是构建此类项目的适当方式。你能帮我把它放在中间吗? import rows from "./mockdata/mock_dashboard"; const rowsData = rows; const useStyles = makeStyles(theme => ({ root: { width: "100%" }, paper: { marginTop: theme.spacing(3), width: "100%", overflowX: "auto", marginBottom: theme.spacing(2), margin: "auto" }, table: { minWidth: 650, maxWidth: 1200 } })); export default function MainDashboard() { const classes = useStyles(); return ( <div className={classes.root}> <Paper className={classes.paper}> <Table className={classes.table} size="small"> <TableHead> <TableRow> <TableCell>Nz.</TableCell> <TableCell>Data Przyjęcia</TableCell> <TableCell>Koordynator</TableCell> <TableCell>Link do Pliku</TableCell> <TableCell>Dod. opis</TableCell> <TableCell>Data Wykonania</TableCell> </TableRow> </TableHead> <TableBody> {rowsData.map(row => ( <TableRow key={row.orderNo}> <TableCell component="th" scope="row"> {row.orderNo} </TableCell> <TableCell align="center">{row.orderDate}</TableCell> <TableCell align="center">{row.coordinator}</TableCell> <TableCell align="center">{row.link}</TableCell> <TableCell align="center" className={classes.descriptionFont}> {row.description} </TableCell> <TableCell align="center">{row.dueDate}</TableCell> </TableRow> ))} </TableBody> </Table> </Paper> </div> );
Reactjs 如何在材质UI图纸元素上居中放置表格 我的问题是,我试图把固定大小的表放在页面中间(在一个纸组件中),失败得很惨。我在材质ui方面也很新,所以我不确定这是否是构建此类项目的适当方式。你能帮我把它放在中间吗? import rows from "./mockdata/mock_dashboard"; const rowsData = rows; const useStyles = makeStyles(theme => ({ root: { width: "100%" }, paper: { marginTop: theme.spacing(3), width: "100%", overflowX: "auto", marginBottom: theme.spacing(2), margin: "auto" }, table: { minWidth: 650, maxWidth: 1200 } })); export default function MainDashboard() { const classes = useStyles(); return ( <div className={classes.root}> <Paper className={classes.paper}> <Table className={classes.table} size="small"> <TableHead> <TableRow> <TableCell>Nz.</TableCell> <TableCell>Data Przyjęcia</TableCell> <TableCell>Koordynator</TableCell> <TableCell>Link do Pliku</TableCell> <TableCell>Dod. opis</TableCell> <TableCell>Data Wykonania</TableCell> </TableRow> </TableHead> <TableBody> {rowsData.map(row => ( <TableRow key={row.orderNo}> <TableCell component="th" scope="row"> {row.orderNo} </TableCell> <TableCell align="center">{row.orderDate}</TableCell> <TableCell align="center">{row.coordinator}</TableCell> <TableCell align="center">{row.link}</TableCell> <TableCell align="center" className={classes.descriptionFont}> {row.description} </TableCell> <TableCell align="center">{row.dueDate}</TableCell> </TableRow> ))} </TableBody> </Table> </Paper> </div> );,reactjs,material-ui,Reactjs,Material Ui,从“/mockdata/mock_dashboard”导入行; const rowsData=行; const useStyles=makeStyles(主题=>({ 根目录:{ 宽度:“100%” }, 论文:{ marginTop:主题。间距(3), 宽度:“100%”, overflowX:“自动”, marginBottom:主题。间距(2), 页边空白:“自动” }, 表:{ 最小宽度:650, 最大宽度:1200 } })); 导出默认函数MainDashboard(){ const
从“/mockdata/mock_dashboard”导入行;
const rowsData=行;
const useStyles=makeStyles(主题=>({
根目录:{
宽度:“100%”
},
论文:{
marginTop:主题。间距(3),
宽度:“100%”,
overflowX:“自动”,
marginBottom:主题。间距(2),
页边空白:“自动”
},
表:{
最小宽度:650,
最大宽度:1200
}
}));
导出默认函数MainDashboard(){
const classes=useStyles();
返回(
新西兰。
数据Przyjęcia
库尔德纳
林克多普利库酒店
国防部,opis
维科尼亚数据
{rowsData.map(行=>(
{row.orderNo}
{row.orderDate}
{行协调器}
{row.link}
{row.description}
{row.dueDate}
))}
);
如何以固定的方式包装表格,摆脱固定的表格宽度?它是物料界面布局的基本元素
import Container from '@material-ui/core/Container';
import rows from "./mockdata/mock_dashboard";
const rowsData = rows;
const useStyles = makeStyles(theme => ({
root: {
width: "100%"
},
paper: {
marginTop: theme.spacing(3),
width: "100%",
overflowX: "auto",
marginBottom: theme.spacing(2),
margin: "auto"
},
table: {
width: '100%',
}
}));
export default function MainDashboard() {
const classes = useStyles();
return (
<Container fixed>
<Paper className={classes.paper}>
<Table className={classes.table} size="small">
<TableHead>
<TableRow>
<TableCell>Nz.</TableCell>
<TableCell>Data Przyjęcia</TableCell>
<TableCell>Koordynator</TableCell>
<TableCell>Link do Pliku</TableCell>
<TableCell>Dod. opis</TableCell>
<TableCell>Data Wykonania</TableCell>
</TableRow>
</TableHead>
<TableBody>
{rowsData.map(row => (
<TableRow key={row.orderNo}>
<TableCell component="th" scope="row">
{row.orderNo}
</TableCell>
<TableCell align="center">{row.orderDate}</TableCell>
<TableCell align="center">{row.coordinator}</TableCell>
<TableCell align="center">{row.link}</TableCell>
<TableCell align="center" className={classes.descriptionFont}>
{row.description}
</TableCell>
<TableCell align="center">{row.dueDate}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Paper>
</Container>
);
}
从'@material ui/core/Container'导入容器;
从“/mockdata/mock_dashboard”导入行;
const rowsData=行;
const useStyles=makeStyles(主题=>({
根目录:{
宽度:“100%”
},
论文:{
marginTop:主题。间距(3),
宽度:“100%”,
overflowX:“自动”,
marginBottom:主题。间距(2),
页边空白:“自动”
},
表:{
宽度:“100%”,
}
}));
导出默认函数MainDashboard(){
const classes=useStyles();
返回(
新西兰。
数据Przyjęcia
库尔德纳
林克多普利库酒店
国防部,opis
维科尼亚数据
{rowsData.map(行=>(
{row.orderNo}
{row.orderDate}
{行协调器}
{row.link}
{row.description}
{row.dueDate}
))}
);
}
如何以固定的方式包装表格,摆脱固定的表格宽度?它是物料界面布局的基本元素
import Container from '@material-ui/core/Container';
import rows from "./mockdata/mock_dashboard";
const rowsData = rows;
const useStyles = makeStyles(theme => ({
root: {
width: "100%"
},
paper: {
marginTop: theme.spacing(3),
width: "100%",
overflowX: "auto",
marginBottom: theme.spacing(2),
margin: "auto"
},
table: {
width: '100%',
}
}));
export default function MainDashboard() {
const classes = useStyles();
return (
<Container fixed>
<Paper className={classes.paper}>
<Table className={classes.table} size="small">
<TableHead>
<TableRow>
<TableCell>Nz.</TableCell>
<TableCell>Data Przyjęcia</TableCell>
<TableCell>Koordynator</TableCell>
<TableCell>Link do Pliku</TableCell>
<TableCell>Dod. opis</TableCell>
<TableCell>Data Wykonania</TableCell>
</TableRow>
</TableHead>
<TableBody>
{rowsData.map(row => (
<TableRow key={row.orderNo}>
<TableCell component="th" scope="row">
{row.orderNo}
</TableCell>
<TableCell align="center">{row.orderDate}</TableCell>
<TableCell align="center">{row.coordinator}</TableCell>
<TableCell align="center">{row.link}</TableCell>
<TableCell align="center" className={classes.descriptionFont}>
{row.description}
</TableCell>
<TableCell align="center">{row.dueDate}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Paper>
</Container>
);
}
从'@material ui/core/Container'导入容器;
从“/mockdata/mock_dashboard”导入行;
const rowsData=行;
const useStyles=makeStyles(主题=>({
根目录:{
宽度:“100%”
},
论文:{
marginTop:主题。间距(3),
宽度:“100%”,
overflowX:“自动”,
marginBottom:主题。间距(2),
页边空白:“自动”
},
表:{
宽度:“100%”,
}
}));
导出默认函数MainDashboard(){
const classes=useStyles();
返回(
新西兰。
数据Przyjęcia
库尔德纳
林克多普利库酒店
国防部,opis
维科尼亚数据
{rowsData.map(行=>(
{row.orderNo}
{row.orderDate}
{行协调器}
{row.link}
{row.description}
{row.dueDate}
))}
);
}