【发布时间】:2021-11-22 16:20:12
【问题描述】:
我需要在使用 React Table 库时更改单元格宽度,但我对宽度更改的任何想法都失败了。我需要这样做以使“Użytkownik/Rola”列更接近,就在“Status”列附近。我不想使用负值的 margin-left 因为它通常不是推荐的解决方案。 通常呈现的宽度大于 style={{}} 中提供的宽度 这是它的实现方式:
{
Header: useTranslactionFunc('Status'),
accessor: 'status',
width: 40,
minWidth: 40,
Cell: (props: CellValue) => (
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-start',
marginLeft: '1.5rem',
}}
>
{props.cell.value ? (
<PlayCircleOutlineIcon
style={{
color: theme.palette.success.main,
}}
/>
) : (
<NotInterestedIcon
style={{ color: theme.palette.error.main }}
/>
)}
</div>
),
},
【问题讨论】:
-
你试过设置div的宽度、最大宽度和最小宽度吗?
-
是的,不工作
标签: reactjs react-table