From 61b47e0f008ed1485a3a3a0c485e6889fe6b669d Mon Sep 17 00:00:00 2001 From: zhaojisen <1301338853@qq.com> Date: Fri, 27 Jun 2025 15:44:11 +0800 Subject: [PATCH] Fixed: Fix the adaptive issue of Splitter --- src/app/pages/main/main.component.html | 1 + src/app/pages/main/main.component.ts | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/app/pages/main/main.component.html b/src/app/pages/main/main.component.html index 4be3c181e..1aa083c51 100644 --- a/src/app/pages/main/main.component.html +++ b/src/app/pages/main/main.component.html @@ -27,6 +27,7 @@ class="content" id="right-side" [nzSize]="settingLayoutSize.rightWidth" + [style.flex-grow]="settingLayoutSize.rightWidth === undefined ? 1 : null" >
diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index 44eb8bd3d..2289950f9 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -15,7 +15,10 @@ export class PageMainComponent implements OnInit { showIframeHider = false; showSubMenu: any = false; isDirectNavigation: boolean; - settingLayoutSize = { + settingLayoutSize: { + leftWidth: string | number; + rightWidth: string | number | undefined; + } = { leftWidth: '20%', rightWidth: '80%' }; @@ -49,8 +52,14 @@ export class PageMainComponent implements OnInit { } handleLayoutSettingChange(collapsed: boolean) { - this.settingLayoutSize.leftWidth = collapsed ? '60' : '20%'; - this.settingLayoutSize.rightWidth = collapsed ? (window.innerWidth - 60).toString() : '80%'; + this.collapsed = collapsed; + if (collapsed) { + this.settingLayoutSize.leftWidth = 60; + this.settingLayoutSize.rightWidth = undefined; + } else { + this.settingLayoutSize.leftWidth = '20%'; + this.settingLayoutSize.rightWidth = '80%'; + } } onToggleMobileLayout() {} @@ -100,7 +109,7 @@ export class PageMainComponent implements OnInit { if (leftWidth < 100 && !this.collapsed) { leftWidth = 60; - rightWidth = window.innerWidth - leftWidth; + rightWidth = undefined; this.collapsed = true; } else if (leftWidth > 100 && this.collapsed) { leftWidth = '20%';