diff --git a/customappbar/interfaces/custom_app_bar.js b/customappbar/interfaces/custom_app_bar.js index b7eda8782c4b9b84e23366d06b81f4c519504873..aff4aceee8b401cfe6263aaa1db03a0e94a1d718 100644 --- a/customappbar/interfaces/custom_app_bar.js +++ b/customappbar/interfaces/custom_app_bar.js @@ -808,10 +808,14 @@ export class CustomAppBar extends ViewPU { this.containerWidth = MD_WIDTH; } else if (this.breakPoint === BreakPointsType.LG) { - let displayData = display.getDefaultDisplaySync(); - let windowWidth = px2vp(displayData.width); - let windowHeight = px2vp(displayData.height); - this.containerWidth = windowWidth > windowHeight ? windowHeight * LG_WIDTH_LIMIT : windowWidth * LG_WIDTH_LIMIT; + try { + let displayData = display.getDefaultDisplaySync(); + let windowWidth = px2vp(displayData.width); + let windowHeight = px2vp(displayData.height); + this.containerWidth = windowWidth > windowHeight ? windowHeight * LG_WIDTH_LIMIT : windowWidth * LG_WIDTH_LIMIT; + } catch (error) { + hilog.error(0x3900, LOG_TAG, `getDefaultDisplaySync failed, code is ${error?.code}, message is ${error?.message}`); + } } } } @@ -992,12 +996,12 @@ export class CustomAppBar extends ViewPU { * 半屏放大至全屏动效 */ expendContainerAnimation() { + this.isHalfToFullScreen = true; Context.animateTo({ duration: 150, curve: curves.interpolatingSpring(0, 1, 328, 36), onFinish: () => { this.contentBgColor = '#FFFFFF'; - this.isHalfToFullScreen = true; } }, () => { this.containerWidth = '100%'; diff --git a/customappbar/source/custom_app_bar.ets b/customappbar/source/custom_app_bar.ets index 0743ec6ea38a1ea539fec35ffa1fc0c5f88e89f9..01ebc729439fd33ab5ea91b6f85b39f026c94a1f 100644 --- a/customappbar/source/custom_app_bar.ets +++ b/customappbar/source/custom_app_bar.ets @@ -301,10 +301,15 @@ export struct CustomAppBar { } else if (this.breakPoint === BreakPointsType.MD) { this.containerWidth = MD_WIDTH; } else if (this.breakPoint === BreakPointsType.LG) { - let displayData = display.getDefaultDisplaySync(); - let windowWidth = px2vp(displayData.width); - let windowHeight = px2vp(displayData.height); - this.containerWidth = windowWidth > windowHeight ? windowHeight * LG_WIDTH_LIMIT : windowWidth * LG_WIDTH_LIMIT; + try { + let displayData = display.getDefaultDisplaySync(); + let windowWidth = px2vp(displayData.width); + let windowHeight = px2vp(displayData.height); + this.containerWidth = windowWidth > windowHeight ? windowHeight * LG_WIDTH_LIMIT : windowWidth * LG_WIDTH_LIMIT; + } catch (error) { + hilog.error(0x3900, LOG_TAG, `getDefaultDisplaySync failed, code is ${error?.code}, message is ${error?.message}`); + } + } } } } diff --git a/innerfullscreenlaunchcomponent/interfaces/innerfullscreenlaunchcomponent.js b/innerfullscreenlaunchcomponent/interfaces/innerfullscreenlaunchcomponent.js index b45f5f4383e0956740928906a919a2b01a1507ae..d63004607ab2850b31d48297d1034330ca39564a 100644 --- a/innerfullscreenlaunchcomponent/interfaces/innerfullscreenlaunchcomponent.js +++ b/innerfullscreenlaunchcomponent/interfaces/innerfullscreenlaunchcomponent.js @@ -237,7 +237,7 @@ export class InnerFullScreenLaunchComponent extends ViewPU { UIExtensionComponent.onError(g => { this.isShow = false; hilog.error(0x3900, LOG_TAG, 'call up UIExtension error!%{public}s', g.message); - if (err.code !== ERR_CODE_ABNORMAL) { + if (g.code !== ERR_CODE_ABNORMAL) { this.getUIContext().showAlertDialog({ message: g.message });