【发布时间】:2020-11-01 02:30:32
【问题描述】:
我正在渲染这样的一行
`<TableRow
key={row.name}
>
<TableCell>{row.empId}</TableCell>
<TableCell>{row.userId}</TableCell>
<TableCell>{row.name}</TableCell>
<TableCell>{row.hireDate}</TableCell>
<TableCell>{row.terDate}</TableCell>
<TableCell>{row.empType}</TableCell>
<TableCell>
<Typography variant="button" color={row.empStatus ? 'primary' : 'error'}>
{row.empStatus ? 'Active' : 'Inactive'}
</Typography>{' '}
</TableCell>
<TableCell align="right">
<IconButton aria-label="view log" onClick={() => setOpen(true)}>
<HistoryIcon fontSize="small" />
</IconButton>
<IconButton aria-label="edit">
<EditIcon fontSize="small" />
</IconButton>
</TableCell>
<div className="overley">
<p>overlay text</p>
</div>
</TableRow>`
叠加层具有类似 CSS
`.overley {
position: absolute;
background-color: gainsboro;
opacity: 0.5;
width: 100%;
}
.tableRow {
position: relative;
}`
我期待这样的事情 table
那么如何在不影响表格或行宽和对齐方式的情况下添加覆盖效果或任何显示在行上的 div。
上面的代码在最后添加了一列,如果我给 left : 0,它会移动到屏幕的左侧。有谁知道如何完成这项工作?
【问题讨论】:
标签: javascript css reactjs html-table material-ui