From b8f3af44866cf1088925e7c6dd15dcf0ebf386d0 Mon Sep 17 00:00:00 2001 From: hzm <934585316@qq.com> Date: Fri, 13 Mar 2026 22:30:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=96=91=E9=A9=AC=E7=BA=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/MobileFundTable.jsx | 14 +++++++++++--- app/components/PcFundTable.jsx | 22 ++++++++++++++++++---- app/globals.css | 18 ++++++++++++++++++ 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/app/components/MobileFundTable.jsx b/app/components/MobileFundTable.jsx index 9f31fd9..40852e1 100644 --- a/app/components/MobileFundTable.jsx +++ b/app/components/MobileFundTable.jsx @@ -1013,7 +1013,7 @@ export default function MobileFundTable({ strategy={verticalListSortingStrategy} > - {table.getRowModel().rows.map((row) => ( + {table.getRowModel().rows.map((row, index) => ( {flexRender(cell.column.columnDef.cell, cell.getContext())} diff --git a/app/components/PcFundTable.jsx b/app/components/PcFundTable.jsx index db2d62b..a37dd32 100644 --- a/app/components/PcFundTable.jsx +++ b/app/components/PcFundTable.jsx @@ -954,7 +954,7 @@ export default function PcFundTable({ left: isLeft ? `${column.getStart('left')}px` : undefined, right: isRight ? `${column.getAfter('right')}px` : undefined, zIndex: isHeader ? 11 : 10, - backgroundColor: isHeader ? 'var(--table-pinned-header-bg)' : 'var(--row-bg)', + backgroundColor: isHeader ? 'var(--table-pinned-header-bg)' : 'var(--row-bg, var(--bg))', boxShadow: 'none', textAlign: isNameColumn ? 'left' : 'center', justifyContent: isNameColumn ? 'flex-start' : 'center', @@ -1007,10 +1007,23 @@ export default function PcFundTable({ --row-bg: var(--bg); background-color: var(--row-bg); } + .table-row-scroll:nth-child(even) { + background-color: var(--table-row-alt-bg); + } .table-row-scroll:hover { --row-bg: var(--table-row-hover-bg); } + /* Pinned cells in even rows */ + .row-even .pinned-cell { + background-color: var(--table-row-alt-bg) !important; + } + + /* Pinned cells on hover */ + .table-row-scroll:hover .pinned-cell { + background-color: var(--table-row-hover-bg) !important; + } + /* 覆盖 grid 布局为 flex 以支持动态列宽 */ .table-header-row-scroll, .table-row-scroll { @@ -1092,10 +1105,10 @@ export default function PcFundTable({ strategy={verticalListSortingStrategy} > - {table.getRowModel().rows.map((row) => ( + {table.getRowModel().rows.map((row, index) => (
{row.getVisibleCells().map((cell) => { const columnId = cell.column.id || cell.column.columnDef?.accessorKey; @@ -1118,10 +1131,11 @@ export default function PcFundTable({ const cellClassName = (cell.column.columnDef.meta && cell.column.columnDef.meta.cellClassName) || ''; const style = getCommonPinningStyles(cell.column, false); + const isPinned = cell.column.getIsPinned(); return (
{flexRender( diff --git a/app/globals.css b/app/globals.css index 23ada61..29df3cb 100644 --- a/app/globals.css +++ b/app/globals.css @@ -16,6 +16,7 @@ --border: #1f2937; --table-pinned-header-bg: #2a394b; --table-row-hover-bg: #2a394b; + --table-row-alt-bg: #1a2535; --radius: 0.625rem; --background: #0f172a; --foreground: #e5e7eb; @@ -65,6 +66,7 @@ --border: #e2e8f0; --table-pinned-header-bg: #e2e8f0; --table-row-hover-bg: #e2e8f0; + --table-row-alt-bg: #f8fafc; --background: #ffffff; --foreground: #0f172a; --card-foreground: #0f172a; @@ -449,11 +451,19 @@ body::before { background: #e2e8f0; } +[data-theme="light"] .table-row:nth-child(even) { + background: var(--table-row-alt-bg); +} + [data-theme="light"] .table-row-scroll:hover, [data-theme="light"] .table-row-scroll.row-hovered { background: #e2e8f0; } +[data-theme="light"] .table-row-scroll:nth-child(even) { + background: var(--table-row-alt-bg); +} + [data-theme="light"] .table-fixed-row.row-hovered { background: #e2e8f0; } @@ -1404,6 +1414,10 @@ input[type="number"] { background: rgba(255, 255, 255, 0.08); } +.table-row-scroll:nth-child(even) { + background: var(--table-row-alt-bg); +} + .table-fixed-row.row-hovered { background: rgba(255, 255, 255, 0.08); } @@ -1458,6 +1472,10 @@ input[type="number"] { background: #2a394b; } +.table-row:nth-child(even) { + background: var(--table-row-alt-bg); +} + .table-row:last-child { border-bottom: none; }