From d9c3682df376ecc4be787568c118ed7a45d01833 Mon Sep 17 00:00:00 2001 From: Zhicheng WANG Date: Sat, 13 Jun 2020 09:30:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=AD=A3=E7=A1=AE=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 不再判断 title,而是增加一个专门的 mode 字段 --- aio/src/app/app.component.ts | 6 +++--- aio/src/app/navigation/navigation.model.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/aio/src/app/app.component.ts b/aio/src/app/app.component.ts index 2025253f1b..b9d2bab8fd 100644 --- a/aio/src/app/app.component.ts +++ b/aio/src/app/app.component.ts @@ -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})`; }); diff --git a/aio/src/app/navigation/navigation.model.ts b/aio/src/app/navigation/navigation.model.ts index c15afecac2..68e52ecabe 100644 --- a/aio/src/app/navigation/navigation.model.ts +++ b/aio/src/app/navigation/navigation.model.ts @@ -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[];