Skip to content

Commit

Permalink
fix(): 如果小产品自定义了title无论什么情况都显示自定义title
Browse files Browse the repository at this point in the history
  • Loading branch information
WHChen-Alex committed Jul 23, 2024
1 parent d58363d commit 9924e46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/runtime/src/internal/Runtime.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 管理专家",
Expand Down
9 changes: 5 additions & 4 deletions packages/runtime/src/internal/Runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,11 @@ 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)
? (router?.getRecentApps().currentApp?.localeTitle as string)
: pageTitle
? `${pageTitle} - ${baseTitle}`
: baseTitle;
}

getNavConfig() {
Expand Down

0 comments on commit 9924e46

Please sign in to comment.