From ad396f2698fe016873e5ce3afd86cd3cc59ccf97 Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Tue, 22 Apr 2025 20:39:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/entryability/EntryAbility.ets | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 595a743..5fffbf1 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -73,21 +73,14 @@ export default class EntryAbility extends UIAbility { let bottomRectHeight: number = avoidArea.bottomRect.height; AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight); this.updateBreakpoint(windowObj.getWindowProperties().windowRect.width); + windowObj.on('windowSizeChange', (windowSize) => { this.updateBreakpoint(windowSize.width); }); - windowStage.loadContent('pages/Index', (error: BusinessError) => { - if (error.code) { - hilog.error(0x0000, TAG, '%{public}s', - `Failed to load the content. code: ${error.code}, message: ${error.message}`); - return; - } - hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in loading the content.'); - }); - let windowClass: window.Window = windowStage.getMainWindowSync(); - windowClass.setWindowLayoutFullScreen(true); + + windowObj.setWindowLayoutFullScreen(true); let sysBarProps: window.SystemBarProperties = { statusBarContentColor: '#FFFFFF' }; - windowClass.setWindowSystemBarProperties(sysBarProps); + windowObj.setWindowSystemBarProperties(sysBarProps); } catch (error) { hilog.error(0x0000, TAG, '%{public}s', `onWindowStageCreate failed. Cause code: ${error.code}, message: ${error.message}`); @@ -95,6 +88,15 @@ export default class EntryAbility extends UIAbility { }).catch((err: BusinessError) => { hilog.error(0x0000, TAG, `Failed to get main window. Cause:`, err.message); }); + + windowStage.loadContent('pages/Index', (error: BusinessError) => { + if (error.code) { + hilog.error(0x0000, TAG, '%{public}s', + `Failed to load the content. code: ${error.code}, message: ${error.message}`); + return; + } + hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in loading the content.'); + }); } onWindowStageDestroy(): void { -- Gitee