From 498ddcd04b2b25f45419376e68d8cac3b7fdd806 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Tue, 5 Aug 2025 20:51:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(utils):=20=E6=B7=BB=E5=8A=A0=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=BD=93=E5=89=8D=E9=A1=B5=E9=9D=A2=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=BAtabbar=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增isCurrentPageTabbar函数,用于检查当前页面是否属于tabbar配置中的页面 --- src/utils/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/index.ts b/src/utils/index.ts index fa81413..20a4b17 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,5 @@ import { pages, subPackages } from '@/pages.json' +import { tabbarList } from '@/tabbar/config' import { isMpWeixin } from './platform' export function getLastPage() { @@ -9,6 +10,13 @@ export function getLastPage() { return pages[pages.length - 1] } +export function isCurrentPageTabbar() { + const lastPage = getLastPage() + const currRoute = (lastPage as any).$page + const { fullPath } = currRoute as { fullPath: string } + return tabbarList.some(item => `/${item.path}` === fullPath) +} + /** * 获取当前页面路由的 path 路径和 redirectPath 路径 * path 如 '/pages/login/index'