From b0aa49e96bdebe58f7c1d33ea7a900719c7c7a40 Mon Sep 17 00:00:00 2001 From: cipchk Date: Sun, 16 Jul 2023 14:17:48 +0800 Subject: [PATCH] fix(abc:reuse-tab): fix cache --- packages/abc/reuse-tab/reuse-tab.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/abc/reuse-tab/reuse-tab.service.ts b/packages/abc/reuse-tab/reuse-tab.service.ts index 92b701aea..cc63f5725 100644 --- a/packages/abc/reuse-tab/reuse-tab.service.ts +++ b/packages/abc/reuse-tab/reuse-tab.service.ts @@ -99,8 +99,6 @@ export class ReuseTabService implements OnDestroy { } /** 自定义当前标题 */ set title(value: string | ReuseTitle) { - if (this.cached == null) return; - const url = this.curUrl; if (typeof value === 'string') value = { text: value }; this.cached.title[url] = value; @@ -373,7 +371,11 @@ export class ReuseTabService implements OnDestroy { @Optional() @Inject(REUSE_TAB_CACHED_MANAGER) private cached: ReuseTabCachedManager, @Optional() @Inject(REUSE_TAB_STORAGE_KEY) private stateKey: string, @Optional() @Inject(REUSE_TAB_STORAGE_STATE) private stateSrv: ReuseTabStorageState - ) {} + ) { + if (this.cached == null) { + this.cached = { list: [], title: {}, closable: {} }; + } + } init(): void { this.initScroll();