feat(breadcrumb): add breadcrumb demo #143

This commit is contained in:
vben
2020-12-24 22:02:24 +08:00
parent 930383f9ae
commit 819bcbe526
26 changed files with 313 additions and 74 deletions

View File

@@ -71,8 +71,10 @@ export async function getShallowMenus(): Promise<Menu[]> {
export async function getChildrenMenus(parentPath: string) {
const menus = await getAsyncMenus();
const parent = menus.find((item) => item.path === parentPath);
if (!parent) return [] as Menu[];
return parent.children;
if (!parent || !parent.children) return [] as Menu[];
const routes = router.getRoutes();
return !isBackMode() ? filter(parent.children, basicFilter(routes)) : parent.children;
}
// 通用过滤方法

View File

@@ -151,9 +151,6 @@ const menu: MenuModule = {
{
path: 'loading',
name: t('routes.demo.comp.loading'),
tag: {
content: 'new',
},
},
{
path: 'tree',
@@ -176,6 +173,9 @@ const menu: MenuModule = {
{
name: t('routes.demo.editor.editor'),
path: 'editor',
tag: {
content: 'new',
},
children: [
{
path: 'markdown',

View File

@@ -19,6 +19,7 @@ const menu: MenuModule = {
path: 'tabs',
name: t('routes.demo.feat.tabs'),
},
{
path: 'context-menu',
name: t('routes.demo.feat.contextMenu'),
@@ -85,6 +86,27 @@ const menu: MenuModule = {
},
],
},
{
name: t('routes.demo.feat.breadcrumb'),
path: 'breadcrumb',
tag: {
content: 'new',
},
children: [
{
path: 'flat',
name: t('routes.demo.feat.breadcrumbFlat'),
},
{
path: 'flatDetail',
name: t('routes.demo.feat.breadcrumbFlatDetail'),
},
{
path: 'children',
name: t('routes.demo.feat.breadcrumbChildrenDetail'),
},
],
},
{
path: 'testTab',
name: t('routes.demo.feat.tab'),

View File

@@ -7,14 +7,14 @@ const menu: MenuModule = {
name: t('routes.demo.iframe.frame'),
path: '/frame',
children: [
{
path: 'antv',
name: t('routes.demo.iframe.antv'),
},
{
path: 'doc',
name: t('routes.demo.iframe.doc'),
},
{
path: 'antv',
name: t('routes.demo.iframe.antv'),
},
{
path: 'https://vvbin.cn/doc-next/',
name: t('routes.demo.iframe.docExternal'),

View File

@@ -6,9 +6,6 @@ const menu: MenuModule = {
menu: {
name: t('routes.demo.level.level'),
path: '/level',
tag: {
dot: true,
},
children: [
{
path: 'menu1',

View File

@@ -6,9 +6,7 @@ const menu: MenuModule = {
menu: {
name: t('routes.demo.page.page'),
path: '/page-demo',
tag: {
dot: true,
},
children: [
{
path: 'form',
@@ -102,9 +100,6 @@ const menu: MenuModule = {
{
path: 'list',
name: t('routes.demo.page.list'),
tag: {
content: 'new',
},
children: [
{
path: 'basic',