From 1d1b4c41ea64af05e1523fa3c439c1a38196833a Mon Sep 17 00:00:00 2001 From: lisa-lian Date: Sat, 12 Jul 2025 11:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86&=E5=8D=8A?= =?UTF-8?q?=E5=B1=8F=E5=8F=98=E5=85=A8=E5=B1=8F=E5=8A=A8=E6=95=88=E6=89=93?= =?UTF-8?q?=E6=96=AD=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3&inner=E7=82=B9?= =?UTF-8?q?=E5=87=BBcrash=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 连漪 --- customappbar/interfaces/custom_app_bar.js | 14 +++++++++----- customappbar/source/custom_app_bar.ets | 13 +++++++++---- .../interfaces/innerfullscreenlaunchcomponent.js | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/customappbar/interfaces/custom_app_bar.js b/customappbar/interfaces/custom_app_bar.js index b7eda87..aff4ace 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 0743ec6..01ebc72 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 b45f5f4..d630046 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 }); -- Gitee