【Antd】Table的斑马线行背景色设置
:global { .odd { background-color: #fff; } .even { background-color: rgba(250, 250, 250, 1); } }
import { Space, Table, Tag } from "antd"; import React, { useState } from "react"; interface IProps { columns: any[]; data: any[]; } const CustomTable: React.FC<any> = (props: IProps) => { const { columns, data } = props; return ( <Table columns={columns} rowClassName={(record, i) => (i % 2 === 1 ? "even" : "odd")} // 重点是这个api dataSource={data} pagination={{ current: 1, total: 50, pageSize: 10 }} /> ); }; export default CustomTable;
漫思