要使 Ant Design 表格的标题加粗,你可以通过设置 columns 中每个列的 title 属性为一个包含样式的 React 元素来实现。具体来说,可以使用 <strong> 标签或者其他 CSS 样式。
以下是如何修改你的代码以使表头加粗的示例:
const columns = [
    {
        title: <strong>列标题1</strong>, // 使用 <strong> 标签
        dataIndex: 'column1',
        key: 'column1',
    },
    {
        title: <strong>列标题2</strong>, // 使用 <strong> 标签
        dataIndex: 'column2',
        key: 'column2',
    },
    // 其他列...
];
// 在 Table 组件中使用这个 columns 数组
<Table
    pagination={false}
    rowSelection={rowSelection}
    columns={columns}
    dataSource={initData}
    loading={loading}
/>
另外,你也可以通过自定义 CSS 来设置标题加粗,例如:
.ant-table-thead > tr > th {
    font-weight: bold; /* 或者使用 font-weight: 600; */
}
这样的话,所有表格标题都会变得加粗,而不仅仅是你单独指定的那些。如果你有更具体的需求或问题,请告诉我!
内容由零声教学AI助手提供,问题来源于学员提问


 
                             
         
        
 
         
         
         
         
         
         
         
        
 
                 
                 
                 
                 
                 
                 
                 
                