docs: 添加外部导航链接
This commit is contained in:
parent
1150e9b6b7
commit
ad4a674b65
|
@ -545,6 +545,16 @@
|
||||||
"tooltip": "关于 Angular 中类和值的详细信息。",
|
"tooltip": "关于 Angular 中类和值的详细信息。",
|
||||||
"url": "api"
|
"url": "api"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"title": "互助问答",
|
||||||
|
"tooltip": "github 上的中文互助问答区",
|
||||||
|
"url": "https://github.com/ng-docs/ng-docs.github.io/issues"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Material 组件库",
|
||||||
|
"tooltip": "Angular Material 组件库的中文文档",
|
||||||
|
"url": "https://material.angular.cn"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"url": "guide/change-log",
|
"url": "guide/change-log",
|
||||||
"title": "Change Log",
|
"title": "Change Log",
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<div *ngIf="!node.children">
|
<div *ngIf="!node.children">
|
||||||
<a href="{{node.url}}" [ngClass]="classes" title="{{node.tooltip}}"
|
<a href="{{node.url}}" [ngClass]="classes" title="{{node.tooltip}}"
|
||||||
class="vertical-menu-item">
|
class="vertical-menu-item" style="position: relative" [target]="isExternalUrl(node.url)?'_blank':'_self'">
|
||||||
{{node.title}}
|
{{node.title}}
|
||||||
|
<mat-icon *ngIf="isExternalUrl(node.url)">open_in_new</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -47,4 +47,8 @@ export class NavItemComponent implements OnChanges {
|
||||||
this.isExpanded = !this.isExpanded;
|
this.isExpanded = !this.isExpanded;
|
||||||
this.setClasses();
|
this.setClasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isExternalUrl(url: string): boolean {
|
||||||
|
return /^https?:/.test(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue