From 4e7ae9a035700dae367324f52c5d8730cad4d79c Mon Sep 17 00:00:00 2001 From: "www.zerocode.net.cn" Date: Tue, 17 Sep 2024 13:08:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=BB=E9=A1=B5=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在"Settings"组件中,通过新增的`handleLogoClick`函数,实现了点击logo返回主页的功能。该功能基于`umi`的历史路由,通过`history.push('/')`实现页面跳转。 --- src/pages/account/settings/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/account/settings/index.tsx b/src/pages/account/settings/index.tsx index 2d95923..e1dde67 100644 --- a/src/pages/account/settings/index.tsx +++ b/src/pages/account/settings/index.tsx @@ -12,6 +12,7 @@ import {Me} from "@icon-park/react"; import * as cache from "@/utils/cache"; import {menuHeaderDropdown} from "@/layouts/HomeLayout"; import {useSearchParams} from "@@/exports"; +import { history } from 'umi'; const {Item} = Menu; @@ -97,12 +98,17 @@ const Settings: React.FC = () => { const licence = cache.getItem2object('licence'); console.log(154, licence, licence?.licensedTo, licence.licensedStartTime); + const handleLogoClick = () => { + history.push('/'); + }; + return (