antd Table使用记录

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/An_cf/article/details/82661091

1.antd table如何关闭hover效果?

需求原因:对于普通表格来说,antd表格的hover完全是可以的,但是在单元格进行了合并的复杂表格中,就会显得很怪;

解决方法:

样式覆盖---------------------

.ant-table-tbody > tr:hover > td{
    background:transparent ! important;
}

2.antd table如何给行添加交错的背景色?

解决方法:

使用rowClassName,可以对行进行设置class--------------------

rowClassName={(record,index)=>index%2===0?'bg_f9':''}

3.antd table如何设置表头背景色?

解决方法:

样式覆盖---------------------

.ant-table-thead > tr > th {
    background: #ffffff !important;
}

4.如何对表格的单元格进行合并?

解决方法:

根据自己的需求在columns里设置------------------------

render: (text, row,ind) => {
    const obj = {
        children: text,
        props: {},
    };
     obj.props.rowSpan = ind?0:1;
    return obj;
}

猜你喜欢

转载自blog.csdn.net/An_cf/article/details/82661091