diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index fbc0b5814fe022b6655cc162af1d1de8dec73ce6..ced332da04e1ce06725f4fa75ab1fddc49352a66 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();