【问题标题】:How to fix text-align, font size and actions column width on react Material Table?如何修复反应材料表上的文本对齐、字体大小和操作列宽?
【发布时间】:2019-06-23 00:58:13
【问题描述】:

我在 React 应用程序中有一个 MaterialTable,我需要将列上的文本居中对齐,固定列上文本的字体大小。还需要固定 Actions 列的宽度,因为 actions 列和第一个数据列之间的空间似乎非常理想。

我试过了:

cellStyle: {text-align:'center', font-size='8'},
headerStyle: {text-align:'center', font-size='8'}

我需要将列上的文本居中对齐,设置文本的字体大小并固定 React Material Table 上操作列的宽度

【问题讨论】:

    标签: reactjs material-table


    【解决方案1】:

    当您使用 JSX 时,您需要更改您的 css 属性并删除 - 并为下一个单词添加大写,例如:

    cellStyle: {text-align:'center', font-size='8'}
    headerStyle: {text-align:'center', font-size='8'}
    

    应该变成

    cellStyle: {textAlign:'center', fontSize='8'}
    headerStyle: {textAlign:'center', fontSize='8'}
    

    【讨论】:

    • 谢谢,但没用。我有这个:
    • 你能不能把你的代码放在沙箱里来帮助你
    • 当然是 Cristobal Soto,我是 React 的新手,javascript,我有这个代码 codesandbox.io/s/elated-https-dtqh0,但在代码框浏览器上没有显示
    【解决方案2】:

    试试这个:

    display: flex;
    justify-content:center;
    flex-direction: column;
    

    【讨论】:

    • 感谢 Maark,但没有在 React Material Table 上工作
    猜你喜欢
    相关资源
    最近更新 更多
    热门标签