From 915f30198d6abb58f40a17bb11fe12fdd7dca140 Mon Sep 17 00:00:00 2001 From: EasyGuohf <163991322+EasyGuohf@users.noreply.github.com> Date: Fri, 20 Jun 2025 17:15:10 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=9B=B8=E5=86=8CSideBar=E7=9B=B4?= =?UTF-8?q?=E6=9D=BF=E6=9C=BA=E9=BB=98=E8=AE=A4=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=202=E3=80=81=E6=96=AD=E7=82=B9Key=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/application/PhotoAlbum.ets | 13 ++++++------- entry/src/main/ets/common/MailContent.ets | 2 +- entry/src/main/ets/common/MailSideBar.ets | 2 +- entry/src/main/ets/common/PhotoContent.ets | 2 +- entry/src/main/ets/common/PhotoSideBar.ets | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/entry/src/main/ets/application/PhotoAlbum.ets b/entry/src/main/ets/application/PhotoAlbum.ets index 8fcefbf..3154fc2 100644 --- a/entry/src/main/ets/application/PhotoAlbum.ets +++ b/entry/src/main/ets/application/PhotoAlbum.ets @@ -24,10 +24,9 @@ let storage = LocalStorage.getShared(); @Entry(storage) @Component struct PhotoAlbum { - @State sideBarStatus: boolean = true; - @StorageProp('currentBreakPoint') currentBreakPoint: string = 'sm'; - @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('currentBreakPoint') curBp: string = CommonConstants.BREAK_POINT_SM; @StorageProp('topRectHeight') topRectHeight: number = 0; + @State sideBarStatus: boolean = this.curBp !== CommonConstants.BREAK_POINT_SM; build() { GridRow() { @@ -46,12 +45,12 @@ struct PhotoAlbum { } .divider({ strokeWidth: 0.5, color: $r('sys.color.comp_divider') }) .controlButton({ - left: new BreakpointType(16 + CommonConstants.BACK_SIZE, 24 + CommonConstants.BACK_SIZE, - 32 + CommonConstants.BACK_SIZE).GetValue(this.curBp), + left: 16 + CommonConstants.BACK_SIZE, top: px2vp(this.topRectHeight), width: 24, height: 24 }) + .showSideBar(this.curBp !== CommonConstants.BREAK_POINT_SM) .onChange((value: boolean) => { this.sideBarStatus = value; }) @@ -62,7 +61,7 @@ struct PhotoAlbum { .fontSize($r('sys.float.Title_M')) } .margin({ - left: new BreakpointType(16, 24, 32).GetValue(this.currentBreakPoint), + left: new BreakpointType(16, 24, 32).GetValue(this.curBp), top: px2vp(this.topRectHeight) }) .backgroundColor(Color.Transparent) @@ -75,7 +74,7 @@ struct PhotoAlbum { } } .onBreakpointChange((breakpoint: string) => { - this.currentBreakPoint = breakpoint; + this.curBp = breakpoint; }) } } \ No newline at end of file diff --git a/entry/src/main/ets/common/MailContent.ets b/entry/src/main/ets/common/MailContent.ets index 28e84d3..152671d 100644 --- a/entry/src/main/ets/common/MailContent.ets +++ b/entry/src/main/ets/common/MailContent.ets @@ -26,7 +26,7 @@ export struct MailContent { new OperateTabs($r('sys.symbol.trash'), $r('app.string.delete')), new OperateTabs($r('sys.symbol.dot_grid_2x2'), $r('app.string.more')), ] - @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('currentBreakPoint') curBp: string = CommonConstants.BREAK_POINT_SM; @StorageProp('bottomRectHeight') bottomRectHeight: number = 0; @StorageProp('topRectHeight') topRectHeight: number = 0; diff --git a/entry/src/main/ets/common/MailSideBar.ets b/entry/src/main/ets/common/MailSideBar.ets index 597fc7c..c4bb725 100644 --- a/entry/src/main/ets/common/MailSideBar.ets +++ b/entry/src/main/ets/common/MailSideBar.ets @@ -40,7 +40,7 @@ struct AccountInfo { 'xxxxxxxxxxxxx', 'xxxxxxxxxxxxx', ] - @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('currentBreakPoint') curBp: string = CommonConstants.BREAK_POINT_SM; @Builder accountInfo() { diff --git a/entry/src/main/ets/common/PhotoContent.ets b/entry/src/main/ets/common/PhotoContent.ets index 5092f7c..8c060ae 100644 --- a/entry/src/main/ets/common/PhotoContent.ets +++ b/entry/src/main/ets/common/PhotoContent.ets @@ -31,7 +31,7 @@ export struct PhotoContent { ] @State columnsTemplate: string = '1fr 1fr 1fr'; @Link @Watch('onStateChange') sideBarStatus: boolean; - @StorageProp('currentBreakpoint') currentBreakPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('currentBreakPoint') currentBreakPoint: string = CommonConstants.BREAK_POINT_SM; @StorageProp('topRectHeight') topRectHeight: number = 0; aboutToAppear() { diff --git a/entry/src/main/ets/common/PhotoSideBar.ets b/entry/src/main/ets/common/PhotoSideBar.ets index 9a9c880..43afaa2 100644 --- a/entry/src/main/ets/common/PhotoSideBar.ets +++ b/entry/src/main/ets/common/PhotoSideBar.ets @@ -30,7 +30,7 @@ export struct PhotoSideBar { new PhotoType($r('app.string.pictureType'), 22), new PhotoType($r('app.string.hidden'), 1), ]; - @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('currentBreakPoint') curBp: string = CommonConstants.BREAK_POINT_SM; @StorageProp('topRectHeight') topRectHeight: number = 0; build() { -- Gitee