fix: 正确显示当前版本
不再判断 title,而是增加一个专门的 mode 字段
This commit is contained in:
parent
412360f845
commit
d9c3682df3
@ -160,8 +160,8 @@ export class AppComponent implements OnInit {
|
||||
]).subscribe(([versionInfo, versions]) => {
|
||||
// TODO(pbd): consider whether we can lookup the stable and next versions from the internet
|
||||
const computedVersions: NavigationNode[] = [
|
||||
{ title: 'next 版', url: 'https://next.angular.io/' },
|
||||
{ title: '同步翻译版', url: 'https://angular.cn/' },
|
||||
{ mode: 'next', title: 'next 版', url: 'https://next.angular.io/' },
|
||||
{ mode: 'stable', title: '同步翻译版', url: 'https://angular.cn/' },
|
||||
];
|
||||
if (this.deployment.mode === 'archive') {
|
||||
computedVersions.push({ title: `v${versionInfo.major}` });
|
||||
@ -171,7 +171,7 @@ export class AppComponent implements OnInit {
|
||||
// Find the current version - eithers title matches the current deployment mode
|
||||
// or its title matches the major version of the current version info
|
||||
this.currentDocVersion = this.docVersions.find(version =>
|
||||
version.title === this.deployment.mode || version.title === `v${versionInfo.major}`)!;
|
||||
version.mode === this.deployment.mode || version.title === `v${versionInfo.major}`)!;
|
||||
this.currentDocVersion.title += ` (v${versionInfo.raw})`;
|
||||
});
|
||||
|
||||
|
@ -9,6 +9,7 @@ export interface NavigationNode {
|
||||
// always have `title`.
|
||||
title: string;
|
||||
|
||||
mode?: string;
|
||||
url?: string;
|
||||
tooltip?: string;
|
||||
hidden?: boolean;
|
||||
@ -18,7 +19,7 @@ export interface NavigationNode {
|
||||
children?: NavigationNode[];
|
||||
}
|
||||
|
||||
export type NavigationResponse = {__versionInfo: VersionInfo } & { [name: string]: NavigationNode[]|VersionInfo };
|
||||
export type NavigationResponse = { __versionInfo: VersionInfo } & { [name: string]: NavigationNode[] | VersionInfo };
|
||||
|
||||
export interface NavigationViews {
|
||||
[name: string]: NavigationNode[];
|
||||
|
Loading…
x
Reference in New Issue
Block a user