diff --git a/packages/runtime/src/internal/Runtime.spec.ts b/packages/runtime/src/internal/Runtime.spec.ts index 20ecc9316a..65f65978a6 100644 --- a/packages/runtime/src/internal/Runtime.spec.ts +++ b/packages/runtime/src/internal/Runtime.spec.ts @@ -1412,7 +1412,7 @@ describe("Runtime", () => { getRuntime().applyPageTitle("Hello"); expect(document.title).toBe("Hi there"); getRuntime().applyPageTitle(""); - expect(document.title).toBe("DevOps 管理专家"); + expect(document.title).toBe("Hi there"); expect(finishPageView).toBeCalledTimes(1); expect(finishPageView).toBeCalledWith({ pageTitle: "DevOps 管理专家", diff --git a/packages/runtime/src/internal/Runtime.ts b/packages/runtime/src/internal/Runtime.ts index 51df0aa987..8320f622d6 100644 --- a/packages/runtime/src/internal/Runtime.ts +++ b/packages/runtime/src/internal/Runtime.ts @@ -287,10 +287,10 @@ export class Runtime { applyPageTitle(pageTitle: string): void { const baseTitle = this.getBrandSettings().base_title; - document.title = pageTitle - ? (router?.getRecentApps().currentApp?.localeTitle as string) || - `${pageTitle} - ${baseTitle}` - : baseTitle; + + document.title = + (router?.getRecentApps().currentApp?.localeTitle as string) || + (pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle); } getNavConfig() {