我试图在一个单元格内有两行单独的文本,其中一行文本位于另一行之上,在 Material-UI 的数据网格组件中,似乎无法实现任何工作。这是我尝试过的:
const columns: ColDef[] = [
{
field: "name",
headerName: "Sector",
width: 300,
renderCell: (params) => {
let name = params.data.name
const flow = params.data as IOFlow;
const title = Currency.format(flow.value)
+ " " + props.direction
+ " per " + Currency.format(1);
return (
<>
<Typography fullWidth display='block'>
{name}
</Typography>
<br/>
<Typography fullWidth display='block'>
{title}
</Typography>
</>
);
}
},
];
Run Code Online (Sandbox Code Playgroud)
如果我还需要提供更多信息,请告诉我。