Showing
3 changed files
with
12 additions
and
4 deletions
| @@ -19,6 +19,7 @@ const TAG = 'MinePageComponent'; | @@ -19,6 +19,7 @@ const TAG = 'MinePageComponent'; | ||
| 19 | */ | 19 | */ |
| 20 | @Component | 20 | @Component |
| 21 | export struct MinePageComponent { | 21 | export struct MinePageComponent { |
| 22 | + private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px'; | ||
| 22 | //是否是创作者 | 23 | //是否是创作者 |
| 23 | @State isCreator:boolean = false | 24 | @State isCreator:boolean = false |
| 24 | @State isLogin:boolean = false //默认 false 测试放开 | 25 | @State isLogin:boolean = false //默认 false 测试放开 |
| @@ -167,6 +168,8 @@ export struct MinePageComponent { | @@ -167,6 +168,8 @@ export struct MinePageComponent { | ||
| 167 | .backgroundColor($r('app.color.color_F9F9F9')) | 168 | .backgroundColor($r('app.color.color_F9F9F9')) |
| 168 | .scrollable(ScrollDirection.Vertical) | 169 | .scrollable(ScrollDirection.Vertical) |
| 169 | .scrollBar(BarState.Off) | 170 | .scrollBar(BarState.Off) |
| 171 | + // 预留状态栏、导航栏高度 | ||
| 172 | + .margin({ top: this.topRectHeight}) | ||
| 170 | } | 173 | } |
| 171 | 174 | ||
| 172 | 175 |
| @@ -22,6 +22,7 @@ const storage = LocalStorage.getShared(); | @@ -22,6 +22,7 @@ const storage = LocalStorage.getShared(); | ||
| 22 | @Entry(storage) | 22 | @Entry(storage) |
| 23 | @Component | 23 | @Component |
| 24 | export struct TopNavigationComponentNew { | 24 | export struct TopNavigationComponentNew { |
| 25 | + private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px'; | ||
| 25 | /** | 26 | /** |
| 26 | * @deprecated | 27 | * @deprecated |
| 27 | */ | 28 | */ |
| @@ -137,6 +138,8 @@ export struct TopNavigationComponentNew { | @@ -137,6 +138,8 @@ export struct TopNavigationComponentNew { | ||
| 137 | .width('100%') | 138 | .width('100%') |
| 138 | .height('100%') | 139 | .height('100%') |
| 139 | } | 140 | } |
| 141 | + // 预留状态栏 | ||
| 142 | + .margin({ top: this.topRectHeight }) | ||
| 140 | } | 143 | } |
| 141 | 144 | ||
| 142 | @Builder | 145 | @Builder |
| @@ -23,6 +23,7 @@ let storage = LocalStorage.getShared(); | @@ -23,6 +23,7 @@ let storage = LocalStorage.getShared(); | ||
| 23 | @Component | 23 | @Component |
| 24 | export struct BottomNavigationComponent { | 24 | export struct BottomNavigationComponent { |
| 25 | @Provide bottomRectHeight: number = 0 | 25 | @Provide bottomRectHeight: number = 0 |
| 26 | + private bottomRectHeight1: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; | ||
| 26 | @Provide topRectHeight: number = 0 | 27 | @Provide topRectHeight: number = 0 |
| 27 | @Provide isLayoutFullScreen: boolean = false | 28 | @Provide isLayoutFullScreen: boolean = false |
| 28 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL | 29 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL |
| @@ -73,6 +74,7 @@ export struct BottomNavigationComponent { | @@ -73,6 +74,7 @@ export struct BottomNavigationComponent { | ||
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | build() { | 76 | build() { |
| 77 | + Column() { | ||
| 76 | Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) { | 78 | Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) { |
| 77 | ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => { | 79 | ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => { |
| 78 | TabContent() { | 80 | TabContent() { |
| @@ -100,7 +102,7 @@ export struct BottomNavigationComponent { | @@ -100,7 +102,7 @@ export struct BottomNavigationComponent { | ||
| 100 | } | 102 | } |
| 101 | .tabBar(this.tabBarBuilder(navItem, index)) | 103 | .tabBar(this.tabBarBuilder(navItem, index)) |
| 102 | 104 | ||
| 103 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | 105 | + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) |
| 104 | }); | 106 | }); |
| 105 | 107 | ||
| 106 | } | 108 | } |
| @@ -113,10 +115,10 @@ export struct BottomNavigationComponent { | @@ -113,10 +115,10 @@ export struct BottomNavigationComponent { | ||
| 113 | .barBackgroundColor(this.barBackgroundColor) | 115 | .barBackgroundColor(this.barBackgroundColor) |
| 114 | // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域 | 116 | // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域 |
| 115 | .backgroundColor(this.barBackgroundColor) | 117 | .backgroundColor(this.barBackgroundColor) |
| 116 | - .expandSafeArea([SafeAreaType.SYSTEM]) | ||
| 117 | - | ||
| 118 | - // .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致 | 118 | + .layoutWeight(1) |
| 119 | 119 | ||
| 120 | + Blank().width('100%').height(this.bottomRectHeight1).backgroundColor(this.barBackgroundColor) | ||
| 121 | + }.height('100%').width('100%') | ||
| 120 | } | 122 | } |
| 121 | 123 | ||
| 122 | @Builder | 124 | @Builder |
-
Please register or login to post a comment