fix: blog 链接用新标签显示

This commit is contained in:
Zhicheng WANG 2020-03-25 21:25:16 +08:00
parent 72b1aff4e7
commit 15cf692bd9
3 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,7 @@
{ {
"url": "https://blog.wangke.io/", "url": "https://blog.wangke.io/",
"title": "译者博客", "title": "译者博客",
"external": true,
"tooltip": "译者汪志成的博客,包括翻译文章和原创文章" "tooltip": "译者汪志成的博客,包括翻译文章和原创文章"
}, },
{ {

View File

@ -11,11 +11,12 @@ import { NavigationNode } from 'app/navigation/navigation.service';
template: ` template: `
<ul role="navigation"> <ul role="navigation">
<li *ngFor="let node of nodes"> <li *ngFor="let node of nodes">
<a class="nav-link" [class.highlight]="node.highlight" [href]="node.url" [title]="node.title"> <a class="nav-link" [class.highlight]="node.highlight" [href]="node.url" [title]="node.tooltip || node.title"
[target]="node.external?'_blank':null">
<span class="nav-link-inner">{{ node.title }}</span> <span class="nav-link-inner">{{ node.title }}</span>
</a> </a>
</li> </li>
</ul>` </ul>`,
}) })
export class TopMenuComponent { export class TopMenuComponent {
@Input() nodes: NavigationNode[]; @Input() nodes: NavigationNode[];

View File

@ -14,6 +14,7 @@ export interface NavigationNode {
hidden?: boolean; hidden?: boolean;
divider?: boolean; divider?: boolean;
highlight?: boolean; highlight?: boolean;
external?: boolean;
children?: NavigationNode[]; children?: NavigationNode[];
} }