From 2d63ce53b8521a7c383b6f1d572495461396d81f Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Wed, 18 Dec 2024 15:45:15 +0800 Subject: [PATCH] =?UTF-8?q?chore(generate=20menu):=20=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E5=88=86=E5=8C=85=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/tabBar/generateMenu.uts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/tabBar/generateMenu.uts b/pages/tabBar/generateMenu.uts index 85db1e2e..d0c72d15 100644 --- a/pages/tabBar/generateMenu.uts +++ b/pages/tabBar/generateMenu.uts @@ -1,4 +1,4 @@ -import { pages, groups } from '@/pages.json' +import { pages, groups, subPackages } from '@/pages.json' type Group = { id : string, @@ -28,6 +28,16 @@ export type MenuItem = { items : MenuItem[] } +subPackages.forEach(subPackage => { + (subPackage.pages as UTSJSONObject[]).forEach(page => { + pages.push({ + path: `${subPackage.root}/${page.path}`, + style: page.style as UTSJSONObject, + group: page.group + }) + }) +}) + export function generateMenu(tabBarType : string) : MenuItem[] { let res : MenuItem[] = [] const tabBarPages = JSON.parse(JSON.stringify(pages))!.filter((page : Page) : boolean => page.path.startsWith(tabBarType) && hasPageGroup(page.group)) @@ -159,4 +169,4 @@ function addSetTabBarPage(menuItem : MenuItem) { items: [] } as MenuItem) } -} +} -- GitLab