表格增加序号列,移除 id 列

This commit is contained in:
2026-04-07 17:06:19 +08:00
parent edc87c6eea
commit 0789462a8d
9 changed files with 9 additions and 9 deletions

View File

@@ -29,6 +29,7 @@ export type DataTableProps<T> = {
headRow?: string
dataRow?: string
}
serial?: boolean
}
export function DataTable<T extends Record<string, unknown>>(
@@ -36,7 +37,14 @@ export function DataTable<T extends Record<string, unknown>>(
) {
const table = useReactTable({
data: props.data,
columns: props.columns,
columns: [
{
id: "serial",
header: "#",
cell: ({ row }) => row.index + 1,
},
...props.columns,
],
getCoreRowModel: getCoreRowModel(),
manualPagination: true,
rowCount: props.pagination?.total,