Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[优化] 面包屑现在支持无层级关系的路由显示,fixes #855 #867

Merged
merged 5 commits into from
Jan 8, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
optimize demo
Change-Id: I43b60be84a180bf86ec1ffd66bd5634565a41159
  • Loading branch information
hpyou committed Jan 8, 2019
commit a9f1c3b8bba816748d3b2e0eecd44cd92cde9478
8 changes: 6 additions & 2 deletions src/app/demo/breadcrumb/router/demo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,22 @@ export class BreadcrumbRouterDemoComponent {
}

detailBreadcrumbGenerator(routeNode: string): BreadcrumbNode | BreadcrumbNode[] {
// routeNode指当前url的最后一个节点,比如url为breadcrumb/router/detail/1这边的routeNode是1
const detail = this.productService.getProductById(parseInt(routeNode));
// 自定义面包屑节点
return [
// 自定义的节点写在前面,随便写会导致面包屑生成的位置不对
// 节点的顺序是面包屑从左往右的显示顺序
this.getListNode(detail.typeId),
{label: detail.name}
];
};

buyBreadcrumbGenerator(routeNode: string): BreadcrumbNode | BreadcrumbNode[] {
// routeNode指当前url的最后一个节点,比如url为breadcrumb/router/buy/1这边的routeNode是1
const detail = this.productService.getProductById(parseInt(routeNode));
// 自定义面包屑节点
return [
// 自定义的节点写在前面,随便写会导致面包屑生成的位置不对
// 节点的顺序是面包屑从左往右的显示顺序
this.getListNode(detail.typeId),
this.getDetailNode(detail),
{label: 'Buy', icon: 'fa fa-shopping-cart'}
Expand Down