提交 2d63ce53 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

chore(generate menu): 兼容分包情况

上级 25353bca
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<Page[]>(JSON.stringify(pages))!.filter((page : Page) : boolean => page.path.startsWith(tabBarType) && hasPageGroup(page.group))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册