From 5aba11d1918709dabc0c3de4357c4ccb48959183 Mon Sep 17 00:00:00 2001 From: swx1239486 Date: Tue, 8 Aug 2023 14:07:04 +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 a877396d45..2a746bd850 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 @@ -352,8 +352,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() @@ -374,7 +375,10 @@ struct SideBarSample { .width(180) .height(36) .onClick(() => { - this.selectIndex = index + this.selectIndex = index; + if(this.currentBreakpoint === 'sm'){ + this.showSideBar=false + } }) } @@ -402,8 +406,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