Skip to content

Commit

Permalink
fix: 切换“是否展示tab时”,由不展示tab到展示tab,刷新页面
Browse files Browse the repository at this point in the history
  • Loading branch information
huajian123 committed Feb 13, 2023
1 parent 09dc52a commit 96f2245
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/app/layout/default/setting-drawer/setting-drawer.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DOCUMENT } from '@angular/common';
import { ChangeDetectionStrategy, Component, Inject, OnInit, Renderer2 } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, RouteReuseStrategy } from '@angular/router';
import { first } from 'rxjs/operators';

import { IsNightKey, ThemeOptionsKey } from '@config/constant';
Expand Down Expand Up @@ -212,18 +212,22 @@ export class SettingDrawerComponent implements OnInit {
}

// 修改固定头部
changeFixed(isFixed: boolean, type: 'isShowTab' | 'splitNav' | 'fixedTab' | 'fixedLeftNav' | 'fixedHead' | 'hasTopArea' | 'hasFooterArea' | 'hasNavArea' | 'hasNavHeadArea'): void {
changeFixed(isTrue: boolean, type: 'isShowTab' | 'splitNav' | 'fixedTab' | 'fixedLeftNav' | 'fixedHead' | 'hasTopArea' | 'hasFooterArea' | 'hasNavArea' | 'hasNavHeadArea'): void {
// 非固定头部时,设置标签也不固定
if (type === 'fixedHead' && !isFixed) {
if (type === 'fixedHead' && !isTrue) {
this._themesOptions['fixedTab'] = false;
}
this._themesOptions[type] = isFixed;
this._themesOptions[type] = isTrue;
this.setThemeOptions();

// 如果不展示多标签,则要清空tab,以及已经被缓存的所有组件
if (type === 'isShowTab') {
if (!isFixed) {
SimpleReuseStrategy.deleteAllRouteSnapshot(this.activatedRoute.snapshot).then();
if (!isTrue) {
SimpleReuseStrategy.deleteAllRouteSnapshot(this.activatedRoute.snapshot).then(() => {
this.tabService.clearTabs();
});
} else {
this.tabService.refresh();
}
}
}
Expand Down

0 comments on commit 96f2245

Please sign in to comment.