From de5163e8e8d0c7a655abf200a4620b8151825f9f Mon Sep 17 00:00:00 2001 From: 26thE <962961353@qq.com> Date: Thu, 3 Apr 2025 17:33:17 +0800 Subject: [PATCH] =?UTF-8?q?HMOS=E4=B8=96=E7=95=8C=E6=95=B4=E6=94=B9Sample?= =?UTF-8?q?=EF=BC=8C=E6=B5=81=E7=95=85=E5=88=B7=E6=96=87=E7=AB=A0=EF=BC=8C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/entryability/EntryAbility.ets | 5 ++--- entry/src/main/ets/view/SampleUnitView.ets | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 52b6c8c..56deb8c 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -23,7 +23,6 @@ import { Constants } from '../common/Constants'; const TAG: string = '[EntryAbility]' export default class EntryAbility extends UIAbility { - private windowObj?: window.Window; private curBp: string = ''; private updateBreakpoint(windowWidth: number): void { @@ -38,10 +37,11 @@ export default class EntryAbility extends UIAbility { newBp = Constants.BREAK_POINT_LG; } if (this.curBp !== newBp) { + this.curBp = newBp; AppStorage.setOrCreate('currentBreakpoint', this.curBp); } } catch (error) { - hilog.error(0x0000, TAG, 'updateBreakpoint catch err:', JSON.stringify(error) ?? ''); + hilog.error(0x0000, TAG, `updateBreakpoint catch err:`, JSON.stringify((error as BusinessError).message) ?? ''); } } @@ -60,7 +60,6 @@ export default class EntryAbility extends UIAbility { avoidArea = windowObj.getWindowAvoidArea(type); let topRectHeight = avoidArea.topRect.height; AppStorage.setOrCreate('topRectHeight', topRectHeight); - this.windowObj = windowObj; this.updateBreakpoint(windowObj.getWindowProperties().windowRect.width); windowObj.on('windowSizeChange', (windowSize) => { this.updateBreakpoint(windowSize.width); diff --git a/entry/src/main/ets/view/SampleUnitView.ets b/entry/src/main/ets/view/SampleUnitView.ets index f2376dc..f6a03c5 100644 --- a/entry/src/main/ets/view/SampleUnitView.ets +++ b/entry/src/main/ets/view/SampleUnitView.ets @@ -36,7 +36,6 @@ export default struct SampleUnitView { @Prop buttonUnit: ButtonUnitItem; @Prop type: string; @Prop imageArray: Resource[]; - private controller: VideoController = new VideoController(); build() { Flex({ direction: FlexDirection.Column }) { @@ -48,7 +47,7 @@ export default struct SampleUnitView { .fontFamily(FONT_FAMILY) .margin({ bottom: STATIC_MARGIN }) if (this.type === TYPE_ENUM[0]) { - SampleUnitVideoView({ controller: this.controller }); + SampleUnitVideoView(); } else if (this.type === TYPE_ENUM[1]) { SampleUnitPicView({ imageArray: this.imageArray }); } -- Gitee