From a30ef66241ba318acc0bb2b929b88273455bead7 Mon Sep 17 00:00:00 2001 From: ruotongyu Date: Mon, 17 Jun 2024 22:44:45 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20ui(autoMate):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E6=A0=B7=E5=BC=8F=E4=BB=A5=E5=8F=8A=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=B7=B3=E8=BD=AC=E8=87=B3=E7=AC=AC=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E9=A1=B5=20=20=20=F0=9F=93=9D=20ui(autoMate)?= =?UTF-8?q?:=20=E5=BC=95=E5=85=A5react=E7=9A=84useEffect=E5=92=8CuseNaviga?= =?UTF-8?q?te=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/renderer/src/pages/ContentList/content.scss | 4 ++++ ui/autoMate/src/renderer/src/pages/ContentList/index.tsx | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/autoMate/src/renderer/src/pages/ContentList/content.scss b/ui/autoMate/src/renderer/src/pages/ContentList/content.scss index 65f348b..065c42d 100644 --- a/ui/autoMate/src/renderer/src/pages/ContentList/content.scss +++ b/ui/autoMate/src/renderer/src/pages/ContentList/content.scss @@ -7,6 +7,10 @@ grid-area: list; a { @apply block truncate py-1 px-1 cursor-pointer; + &.active{ + // mx-1 外边距 + @apply bg-blue-700 text-white mx-1 rounded-md; + } } } .content{ diff --git a/ui/autoMate/src/renderer/src/pages/ContentList/index.tsx b/ui/autoMate/src/renderer/src/pages/ContentList/index.tsx index 1643167..1cd700f 100644 --- a/ui/autoMate/src/renderer/src/pages/ContentList/index.tsx +++ b/ui/autoMate/src/renderer/src/pages/ContentList/index.tsx @@ -1,8 +1,15 @@ -import { NavLink, Outlet, useLoaderData } from "react-router-dom" +import { NavLink, Outlet, useLoaderData, useNavigate } from "react-router-dom" import "./content.scss" +import { useEffect } from "react" export const ContentList = () => { const contentList = useLoaderData() as ContentType[] + const navigate = useNavigate() + useEffect(() => { + if (contentList) { + navigate(`/config/category/contentList/${contentList[0].category_id}/content/${contentList[0].id}`) + } + }, [contentList]) return (
{contentList.map(content => (