: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;
版权声明:本文为hzxOnlineOk原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。