From e79ea720fe138001d8dc7bc38ab734b89ad9eeec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=9E=E6=BC=AA?= Date: Wed, 9 Jul 2025 19:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8D=8A=E5=B1=8F=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E5=BC=8F=E6=8B=89=E8=B5=B7=E6=97=A0=E5=8A=A8=E6=95=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 连漪 --- customappbar/interfaces/custom_app_bar.js | 27 +++++++++++------------ customappbar/source/custom_app_bar.ets | 27 +++++++++++------------ 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/customappbar/interfaces/custom_app_bar.js b/customappbar/interfaces/custom_app_bar.js index b7eda87..56937fb 100644 --- a/customappbar/interfaces/custom_app_bar.js +++ b/customappbar/interfaces/custom_app_bar.js @@ -706,20 +706,6 @@ export class CustomAppBar extends ViewPU { set labelName(newValue) { this.__labelName.set(newValue); } - aboutToAppear() { - if (this.isHalfScreen) { - this.contentBgColor = Color.Transparent; - this.titleHeight = EYELASH_HEIGHT + 2 * TITLE_MARGIN_TOP + this.statusBarHeight; - this.halfScreenShowAnimation(); - } - else { - this.containerHeight = '100%'; - this.containerWidth = '100%'; - } - this.updateStringByResource(); - this.getDeviceRadiusConfig(); - this.subscribePrivacyState(); - } aboutToDisappear() { this.smListener.off('change'); this.mdListener.off('change'); @@ -1462,6 +1448,19 @@ export class CustomAppBar extends ViewPU { Stack.backgroundColor(ObservedObject.GetRawObject(this.contentBgColor)); Stack.hitTestBehavior(HitTestMode.Transparent); Stack.id('AtomicServiceContainerId'); + Stack.onAppear(() => { + if (this.isHalfScreen) { + this.contentBgColor = Color.Transparent; + this.titleHeight = EYELASH_HEIGHT + 2 * TITLE_MARGIN_TOP + this.statusBarHeight; + this.halfScreenShowAnimation(); + } else { + this.containerHeight = '100%'; + this.containerWidth = '100%'; + } + this.updateStringByResource(); + this.getDeviceRadiusConfig(); + this.subscribePrivacyState(); + }) }, Stack); this.observeComponentCreation2((elmtId, isInitialRender) => { If.create(); diff --git a/customappbar/source/custom_app_bar.ets b/customappbar/source/custom_app_bar.ets index 0743ec6..9671da3 100644 --- a/customappbar/source/custom_app_bar.ets +++ b/customappbar/source/custom_app_bar.ets @@ -198,20 +198,6 @@ export struct CustomAppBar { events: ['usual.event.PRIVACY_STATE_CHANGED'] }; - aboutToAppear(): void { - if (this.isHalfScreen) { - this.contentBgColor = Color.Transparent; - this.titleHeight = EYELASH_HEIGHT + 2 * TITLE_MARGIN_TOP + this.statusBarHeight; - this.halfScreenShowAnimation(); - } else { - this.containerHeight = '100%'; - this.containerWidth = '100%'; - } - this.updateStringByResource(); - this.getDeviceRadiusConfig(); - this.subscribePrivacyState(); - } - aboutToDisappear(): void { this.smListener.off('change'); this.mdListener.off('change'); @@ -945,6 +931,19 @@ export struct CustomAppBar { .backgroundColor(this.contentBgColor) .hitTestBehavior(HitTestMode.Transparent) .id('AtomicServiceContainerId') + .onAppear(() => { + if (this.isHalfScreen) { + this.contentBgColor = Color.Transparent; + this.titleHeight = EYELASH_HEIGHT + 2 * TITLE_MARGIN_TOP + this.statusBarHeight; + this.halfScreenShowAnimation(); + } else { + this.containerHeight = '100%'; + this.containerWidth = '100%'; + } + this.updateStringByResource(); + this.getDeviceRadiusConfig(); + this.subscribePrivacyState(); + }) } .height('100%') .width('100%') -- Gitee