From aca3aa8f6bbec472f64d099511a5b53197f19f09 Mon Sep 17 00:00:00 2001 From: Childish-Ghost Date: Fri, 18 Jul 2025 23:48:55 +0800 Subject: [PATCH] =?UTF-8?q?V0.1.2.20250718=20=E2=80=94=E2=80=94=E2=80=94?= =?UTF-8?q?=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94?= =?UTF-8?q?=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=201.=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E9=87=8D=E5=AE=9A=E5=90=91=202.Home=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=A4=B4=E9=83=A8=E5=AE=8C=E6=88=90=20=E2=80=94=E2=80=94?= =?UTF-8?q?=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94?= =?UTF-8?q?=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ordinary/Home.vue | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/views/ordinary/Home.vue b/src/views/ordinary/Home.vue index 2fa13e2..b8d4e64 100644 --- a/src/views/ordinary/Home.vue +++ b/src/views/ordinary/Home.vue @@ -2,9 +2,11 @@ import "@/assets/ordinary/Home.css" import {ref} from 'vue' import { UserFilled } from '@element-plus/icons-vue' -const activeIndex = ref('1') -const handleSelect = (key: string, keyPath: string[]) => { - console.log(key, keyPath) +import {useRouter} from "vue-router"; +const router = useRouter() +const activeIndex = ref(router.currentRoute.value.path) // 根据当前路由设置激活状态 +const handleSelect = (path: string) => { + router.push(path) } @@ -18,12 +20,13 @@ const handleSelect = (key: string, keyPath: string[]) => { mode="horizontal" :ellipsis="false" @select="handleSelect" + router > - 首页 - 图书 - 期刊 - 报纸 + 首页 + 图书 + 期刊 + 报纸
@@ -35,6 +38,9 @@ const handleSelect = (key: string, keyPath: string[]) => {
+
+ +