From d2dcddc7e50b8253444c6b82788c069d8b9745cc Mon Sep 17 00:00:00 2001 From: yxk2026 <10178404+yxk2026@user.noreply.gitee.com> Date: Wed, 30 Apr 2025 16:30:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=97=8B=E8=BD=AC=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/entryability/EntryAbility.ets | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index fbc0b58..ced332d 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -26,6 +26,8 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('currentWidthBreakpoint', widthBp); let heightBp: HeightBreakpoint = this.uiContext!.getWindowHeightBreakpoint(); AppStorage.setOrCreate('currentHeightBreakpoint', heightBp); + AppStorage.setOrCreate('windowHeight', windowSize.height); + AppStorage.setOrCreate('windowWidth', windowSize.width); }; // [StartExclude get_breakPoint] @@ -102,8 +104,11 @@ export default class EntryAbility extends UIAbility { Logger.error('Failed to obtain the main window. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } - - // Determine the type of attribute value and process it + // Window size acquisition and monitoring. + let properties = data.getWindowProperties(); + AppStorage.setOrCreate('windowHeight', properties.windowRect.height); + AppStorage.setOrCreate('windowWidth', properties.windowRect.width); + // Breakpoint acquisition and listening. this.uiContext = data.getUIContext(); let widthBp: WidthBreakpoint = this.uiContext.getWindowWidthBreakpoint(); let heightBp: HeightBreakpoint = this.uiContext.getWindowHeightBreakpoint(); -- Gitee