From 8a23b158ea3e0569080b3cd3dd11308245d8c2ba Mon Sep 17 00:00:00 2001 From: swx1239486 Date: Tue, 8 Aug 2023 11:46:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BE=A7=E8=BE=B9=E6=A0=8Fde?= =?UTF-8?q?mo=EF=BC=8C=E4=BD=BF=E4=B9=8B=E6=AD=A3=E5=B8=B8=E8=BF=90?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: swx1239486 --- .../multi-device-app-dev/typical-layout-scenario.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md b/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md index b53b9b4b6f..9ce49b2a0c 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md @@ -353,8 +353,9 @@ struct MultiLaneList { @Component struct SideBarSample { @StorageLink('currentBreakpoint') private currentBreakpoint: string = "md"; - private breakpointSystem: BreakpointSystem = new BreakpointSystem() + private breakpointSystem: BreakpointSystem = new BreakpointSystem(); @State selectIndex: number = 0; + @State showSideBar:boolean=false; aboutToAppear() { this.breakpointSystem.register() @@ -375,7 +376,10 @@ struct SideBarSample { .width(180) .height(36) .onClick(() => { - this.selectIndex = index + this.selectIndex = index; + if(this.currentBreakpoint === 'sm'){ + this.showSideBar=false + } }) } @@ -403,8 +407,11 @@ struct SideBarSample { .maxSideBarWidth(this.currentBreakpoint === 'sm' ? '100%' : '33.33%') .showControlButton(this.currentBreakpoint === 'sm') .autoHide(false) + .showSideBar(this.currentBreakpoint !== 'sm'||this.showSideBar) .onChange((isBarShow: boolean) => { - + if(this.currentBreakpoint === 'sm'){ + this.showSideBar=isBarShow + } }) } } -- GitLab