fix(md-deck): Make active card state reactive

Wrap active in a getter so it updates when activeTab changes.
This commit is contained in:
hyper
2026-08-07 12:07:54 +08:00
parent a69a41875d
commit e3daac3080
+2 -2
View File
@@ -38,12 +38,12 @@ export function CardList(props: CardListProps) {
<For each={pageCards()}>
{(card, index) => {
const globalIndex = () => page() * PAGE_SIZE + index();
const active = store.state.activeTab === globalIndex();
const active = () => store.state.activeTab === globalIndex();
return (
<button
onClick={() => store.actions.setActiveTab(globalIndex())}
class={`flex items-center gap-2 w-full text-left px-3 py-2 rounded text-sm font-medium transition-colors cursor-pointer ${
active
active()
? "bg-blue-100 text-blue-600"
: "text-gray-600 hover:bg-gray-100"
}`}