Showing
1 changed file
with
31 additions
and
4 deletions
| @@ -49,7 +49,7 @@ export struct BottomNavigationComponent { | @@ -49,7 +49,7 @@ export struct BottomNavigationComponent { | ||
| 49 | /** | 49 | /** |
| 50 | * Component opacity value: 0.6. | 50 | * Component opacity value: 0.6. |
| 51 | */ | 51 | */ |
| 52 | - readonly SIXTY_OPACITY: number = 0.6; | 52 | + readonly SIXTY_OPACITY: number = 0.8; |
| 53 | // 用于传参到顶导组件,【不用channelParam,主要是时序问题,需要先底导处理完,再延时触发顶导处理】 | 53 | // 用于传参到顶导组件,【不用channelParam,主要是时序问题,需要先底导处理完,再延时触发顶导处理】 |
| 54 | @State assignChannel: AssignChannelParam = new AssignChannelParam() | 54 | @State assignChannel: AssignChannelParam = new AssignChannelParam() |
| 55 | // 自动刷新触发(双击tab自动刷新) | 55 | // 自动刷新触发(双击tab自动刷新) |
| @@ -140,7 +140,7 @@ export struct BottomNavigationComponent { | @@ -140,7 +140,7 @@ export struct BottomNavigationComponent { | ||
| 140 | .fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal) | 140 | .fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal) |
| 141 | .textAlign(TextAlign.Center) | 141 | .textAlign(TextAlign.Center) |
| 142 | .fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray) | 142 | .fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray) |
| 143 | - .fontColor(this.currentNavIndex === index ? navItem.nameCColor : navItem.nameColor) | 143 | + .fontColor(this.currentNavIndex === index ? this.setTabbarNameCColor(navItem) : this.setTabbarNameColor(navItem)) |
| 144 | .opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY) | 144 | .opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY) |
| 145 | } | 145 | } |
| 146 | .zIndex(10) | 146 | .zIndex(10) |
| @@ -167,10 +167,34 @@ export struct BottomNavigationComponent { | @@ -167,10 +167,34 @@ export struct BottomNavigationComponent { | ||
| 167 | 167 | ||
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | + private setTabbarNameCColor(navItem:BottomNavDTO) { | ||
| 171 | + | ||
| 172 | + if (this.isImmersive) { | ||
| 173 | + return navItem.immersiveNameCColor | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + if (this.isNight) { | ||
| 177 | + return navItem.nightNameCColor | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + return navItem.nameCColor | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + private setTabbarNameColor(navItem:BottomNavDTO) { | ||
| 184 | + | ||
| 185 | + if (this.isImmersive) { | ||
| 186 | + return navItem.immersiveNameColor | ||
| 187 | + } | ||
| 188 | + if (this.isNight) { | ||
| 189 | + return navItem.nightNameColor | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + return navItem.nameColor | ||
| 193 | + } | ||
| 194 | + | ||
| 170 | getBottomImageKnifeOption(navItem: BottomNavDTO, isSelect: boolean): ImageKnifeOption { | 195 | getBottomImageKnifeOption(navItem: BottomNavDTO, isSelect: boolean): ImageKnifeOption { |
| 171 | let defaultIcon = this.getBottomLocalIcon(navItem, isSelect) | 196 | let defaultIcon = this.getBottomLocalIcon(navItem, isSelect) |
| 172 | let url = this.getBottomIcon(navItem, isSelect) | 197 | let url = this.getBottomIcon(navItem, isSelect) |
| 173 | - | ||
| 174 | let imageKnifeOption: ImageKnifeOption = { | 198 | let imageKnifeOption: ImageKnifeOption = { |
| 175 | loadSrc: url, | 199 | loadSrc: url, |
| 176 | // 占位图使用本地资源 | 200 | // 占位图使用本地资源 |
| @@ -196,6 +220,9 @@ export struct BottomNavigationComponent { | @@ -196,6 +220,9 @@ export struct BottomNavigationComponent { | ||
| 196 | if (this.isImmersive) { | 220 | if (this.isImmersive) { |
| 197 | // 获取沉浸式icon | 221 | // 获取沉浸式icon |
| 198 | icon = isSelect ? navItem.immersiveIconCUrl : navItem.immersiveIconUrl | 222 | icon = isSelect ? navItem.immersiveIconCUrl : navItem.immersiveIconUrl |
| 223 | + } else if (this.isNight) { | ||
| 224 | + // 获取暗黑模式 icon | ||
| 225 | + icon = isSelect ? navItem.nightIconCUrl : navItem.nightIconUrl | ||
| 199 | } else { | 226 | } else { |
| 200 | // 获取常规icon | 227 | // 获取常规icon |
| 201 | icon = isSelect ? navItem.iconC : navItem.icon | 228 | icon = isSelect ? navItem.iconC : navItem.icon |
| @@ -259,7 +286,7 @@ export struct BottomNavigationComponent { | @@ -259,7 +286,7 @@ export struct BottomNavigationComponent { | ||
| 259 | 286 | ||
| 260 | // 底导切换函数 | 287 | // 底导切换函数 |
| 261 | async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) { | 288 | async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) { |
| 262 | - Logger.info(TAG, `onBottomNavigationIndexChange this.currentNavIndex: ${this.currentNavIndex}`); | 289 | + Logger.info(TAG, `onBottomNavigationIndexChange to Index:${index},this.currentNavIndex: ${this.currentNavIndex}`); |
| 263 | 290 | ||
| 264 | if (navItem.name === '我的') { | 291 | if (navItem.name === '我的') { |
| 265 | this.barBackgroundColor = Color.White | 292 | this.barBackgroundColor = Color.White |
-
Please register or login to post a comment