Showing
5 changed files
with
551 additions
and
20 deletions
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
0 → 100644
| 1 | +import { TopNavDTO } from 'wdBean'; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +const INDEX_SETTING_TITLE: string = '首页设置' | ||
| 5 | +const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页' | ||
| 6 | +const MY_CHANNEL: string = '我的频道' | ||
| 7 | +const EDIT_TEXT: string = '编辑' | ||
| 8 | +const EDIT_DOWN: string = '完成' | ||
| 9 | +const MORE_CHANNEL: string = '更多频道' | ||
| 10 | +const LOCAL_CHANNEL: string = '地方频道' | ||
| 11 | + | ||
| 12 | +@CustomDialog | ||
| 13 | +struct CustomDialogExample { | ||
| 14 | + @State indexSettingArray: Array<string> = ['推荐', '热点'] | ||
| 15 | + @State indexSettingTabIndex: number = 1 | ||
| 16 | + @State myChannelList: Array<TopNavDTO> = [ | ||
| 17 | + { | ||
| 18 | + channelId: 0, | ||
| 19 | + channelStyle: 1, | ||
| 20 | + channelType: 1, | ||
| 21 | + defaultPermitted: 1, | ||
| 22 | + delPermitted: 1, | ||
| 23 | + fontCColor: '#000000', | ||
| 24 | + fontColor: '#000000', | ||
| 25 | + headlinesOn: 0, | ||
| 26 | + homeChannel: '1', | ||
| 27 | + iconCUrl: '', | ||
| 28 | + iconCUrlSize: '', | ||
| 29 | + iconUrl: '', | ||
| 30 | + iconUrlSize: '', | ||
| 31 | + localChannel: '', | ||
| 32 | + moreChannel: '', | ||
| 33 | + movePermitted: 0, | ||
| 34 | + myChannel: '1', | ||
| 35 | + name: '推荐', | ||
| 36 | + num: 0, | ||
| 37 | + pageId: 21212, | ||
| 38 | + pageType: '', | ||
| 39 | + underlineCColor: '' | ||
| 40 | + }, | ||
| 41 | + { | ||
| 42 | + channelId: 1, | ||
| 43 | + channelStyle: 1, | ||
| 44 | + channelType: 1, | ||
| 45 | + defaultPermitted: 1, | ||
| 46 | + delPermitted: 1, | ||
| 47 | + fontCColor: '#000000', | ||
| 48 | + fontColor: '#000000', | ||
| 49 | + headlinesOn: 0, | ||
| 50 | + homeChannel: '1', | ||
| 51 | + iconCUrl: '', | ||
| 52 | + iconCUrlSize: '', | ||
| 53 | + iconUrl: '', | ||
| 54 | + iconUrlSize: '', | ||
| 55 | + localChannel: '', | ||
| 56 | + moreChannel: '', | ||
| 57 | + movePermitted: 0, | ||
| 58 | + myChannel: '1', | ||
| 59 | + name: '热点', | ||
| 60 | + num: 0, | ||
| 61 | + pageId: 21212, | ||
| 62 | + pageType: '', | ||
| 63 | + underlineCColor: '' | ||
| 64 | + }, | ||
| 65 | + { | ||
| 66 | + channelId: 2, | ||
| 67 | + channelStyle: 1, | ||
| 68 | + channelType: 1, | ||
| 69 | + defaultPermitted: 1, | ||
| 70 | + delPermitted: 1, | ||
| 71 | + fontCColor: '#000000', | ||
| 72 | + fontColor: '#000000', | ||
| 73 | + headlinesOn: 0, | ||
| 74 | + homeChannel: '', | ||
| 75 | + iconCUrl: '', | ||
| 76 | + iconCUrlSize: '', | ||
| 77 | + iconUrl: '', | ||
| 78 | + iconUrlSize: '', | ||
| 79 | + localChannel: '', | ||
| 80 | + moreChannel: '', | ||
| 81 | + movePermitted: 0, | ||
| 82 | + myChannel: '1', | ||
| 83 | + name: '视频', | ||
| 84 | + num: 0, | ||
| 85 | + pageId: 21212, | ||
| 86 | + pageType: '', | ||
| 87 | + underlineCColor: '' | ||
| 88 | + }, | ||
| 89 | + { | ||
| 90 | + channelId: 3, | ||
| 91 | + channelStyle: 1, | ||
| 92 | + channelType: 1, | ||
| 93 | + defaultPermitted: 1, | ||
| 94 | + delPermitted: 1, | ||
| 95 | + fontCColor: '#000000', | ||
| 96 | + fontColor: '#000000', | ||
| 97 | + headlinesOn: 0, | ||
| 98 | + homeChannel: '', | ||
| 99 | + iconCUrl: '', | ||
| 100 | + iconCUrlSize: '', | ||
| 101 | + iconUrl: '', | ||
| 102 | + iconUrlSize: '', | ||
| 103 | + localChannel: '', | ||
| 104 | + moreChannel: '', | ||
| 105 | + movePermitted: 0, | ||
| 106 | + myChannel: '1', | ||
| 107 | + name: '云课堂', | ||
| 108 | + num: 0, | ||
| 109 | + pageId: 21212, | ||
| 110 | + pageType: '', | ||
| 111 | + underlineCColor: '' | ||
| 112 | + }, | ||
| 113 | + | ||
| 114 | + ] | ||
| 115 | + @State moreChannelList: Array<TopNavDTO> = [ | ||
| 116 | + { | ||
| 117 | + channelId: 4, | ||
| 118 | + channelStyle: 1, | ||
| 119 | + channelType: 1, | ||
| 120 | + defaultPermitted: 1, | ||
| 121 | + delPermitted: 1, | ||
| 122 | + fontCColor: '#000000', | ||
| 123 | + fontColor: '#000000', | ||
| 124 | + headlinesOn: 0, | ||
| 125 | + homeChannel: '', | ||
| 126 | + iconCUrl: '', | ||
| 127 | + iconCUrlSize: '', | ||
| 128 | + iconUrl: '', | ||
| 129 | + iconUrlSize: '', | ||
| 130 | + localChannel: '', | ||
| 131 | + moreChannel: '1', | ||
| 132 | + movePermitted: 0, | ||
| 133 | + myChannel: '', | ||
| 134 | + name: '房产', | ||
| 135 | + num: 0, | ||
| 136 | + pageId: 21212, | ||
| 137 | + pageType: '', | ||
| 138 | + underlineCColor: '' | ||
| 139 | + }, | ||
| 140 | + { | ||
| 141 | + channelId: 5, | ||
| 142 | + channelStyle: 1, | ||
| 143 | + channelType: 1, | ||
| 144 | + defaultPermitted: 1, | ||
| 145 | + delPermitted: 1, | ||
| 146 | + fontCColor: '#000000', | ||
| 147 | + fontColor: '#000000', | ||
| 148 | + headlinesOn: 0, | ||
| 149 | + homeChannel: '', | ||
| 150 | + iconCUrl: '', | ||
| 151 | + iconCUrlSize: '', | ||
| 152 | + iconUrl: '', | ||
| 153 | + iconUrlSize: '', | ||
| 154 | + localChannel: '', | ||
| 155 | + moreChannel: '1', | ||
| 156 | + movePermitted: 0, | ||
| 157 | + myChannel: '', | ||
| 158 | + name: '生态', | ||
| 159 | + num: 0, | ||
| 160 | + pageId: 21212, | ||
| 161 | + pageType: '', | ||
| 162 | + underlineCColor: '' | ||
| 163 | + }, | ||
| 164 | + { | ||
| 165 | + channelId: 6, | ||
| 166 | + channelStyle: 1, | ||
| 167 | + channelType: 1, | ||
| 168 | + defaultPermitted: 1, | ||
| 169 | + delPermitted: 1, | ||
| 170 | + fontCColor: '#000000', | ||
| 171 | + fontColor: '#000000', | ||
| 172 | + headlinesOn: 0, | ||
| 173 | + homeChannel: '', | ||
| 174 | + iconCUrl: '', | ||
| 175 | + iconCUrlSize: '', | ||
| 176 | + iconUrl: '', | ||
| 177 | + iconUrlSize: '', | ||
| 178 | + localChannel: '', | ||
| 179 | + moreChannel: '1', | ||
| 180 | + movePermitted: 0, | ||
| 181 | + myChannel: '', | ||
| 182 | + name: '健康', | ||
| 183 | + num: 0, | ||
| 184 | + pageId: 21212, | ||
| 185 | + pageType: '', | ||
| 186 | + underlineCColor: '' | ||
| 187 | + } | ||
| 188 | + ] | ||
| 189 | + @State localChannelList: Array<TopNavDTO> = [ | ||
| 190 | + { | ||
| 191 | + channelId: 7, | ||
| 192 | + channelStyle: 1, | ||
| 193 | + channelType: 1, | ||
| 194 | + defaultPermitted: 1, | ||
| 195 | + delPermitted: 1, | ||
| 196 | + fontCColor: '#000000', | ||
| 197 | + fontColor: '#000000', | ||
| 198 | + headlinesOn: 0, | ||
| 199 | + homeChannel: '', | ||
| 200 | + iconCUrl: '', | ||
| 201 | + iconCUrlSize: '', | ||
| 202 | + iconUrl: '', | ||
| 203 | + iconUrlSize: '', | ||
| 204 | + localChannel: '1', | ||
| 205 | + moreChannel: '', | ||
| 206 | + movePermitted: 0, | ||
| 207 | + myChannel: '', | ||
| 208 | + name: '北京', | ||
| 209 | + num: 0, | ||
| 210 | + pageId: 21212, | ||
| 211 | + pageType: '', | ||
| 212 | + underlineCColor: '' | ||
| 213 | + }, | ||
| 214 | + { | ||
| 215 | + channelId: 8, | ||
| 216 | + channelStyle: 1, | ||
| 217 | + channelType: 1, | ||
| 218 | + defaultPermitted: 1, | ||
| 219 | + delPermitted: 1, | ||
| 220 | + fontCColor: '#000000', | ||
| 221 | + fontColor: '#000000', | ||
| 222 | + headlinesOn: 0, | ||
| 223 | + homeChannel: '', | ||
| 224 | + iconCUrl: '', | ||
| 225 | + iconCUrlSize: '', | ||
| 226 | + iconUrl: '', | ||
| 227 | + iconUrlSize: '', | ||
| 228 | + localChannel: '1', | ||
| 229 | + moreChannel: '', | ||
| 230 | + movePermitted: 0, | ||
| 231 | + myChannel: '', | ||
| 232 | + name: '上海', | ||
| 233 | + num: 0, | ||
| 234 | + pageId: 21212, | ||
| 235 | + pageType: '', | ||
| 236 | + underlineCColor: '' | ||
| 237 | + }, | ||
| 238 | + { | ||
| 239 | + channelId: 9, | ||
| 240 | + channelStyle: 1, | ||
| 241 | + channelType: 1, | ||
| 242 | + defaultPermitted: 1, | ||
| 243 | + delPermitted: 1, | ||
| 244 | + fontCColor: '#000000', | ||
| 245 | + fontColor: '#000000', | ||
| 246 | + headlinesOn: 0, | ||
| 247 | + homeChannel: '', | ||
| 248 | + iconCUrl: '', | ||
| 249 | + iconCUrlSize: '', | ||
| 250 | + iconUrl: '', | ||
| 251 | + iconUrlSize: '', | ||
| 252 | + localChannel: '1', | ||
| 253 | + moreChannel: '', | ||
| 254 | + movePermitted: 0, | ||
| 255 | + myChannel: '', | ||
| 256 | + name: '江苏', | ||
| 257 | + num: 0, | ||
| 258 | + pageId: 21212, | ||
| 259 | + pageType: '', | ||
| 260 | + underlineCColor: '' | ||
| 261 | + } | ||
| 262 | + ] | ||
| 263 | + @State isEditIng: boolean = false | ||
| 264 | + myChannelItemEditHandle = (index: number): void => { | ||
| 265 | + let item = this.myChannelList.splice(index, 1)[0] | ||
| 266 | + if (item.moreChannel === '1') { | ||
| 267 | + this.moreChannelList.unshift(item) | ||
| 268 | + } | ||
| 269 | + if (item.localChannel === '1') { | ||
| 270 | + this.localChannelList.unshift(item) | ||
| 271 | + } | ||
| 272 | + } | ||
| 273 | + controller?: CustomDialogController | ||
| 274 | + cancel: () => void = () => { | ||
| 275 | + } | ||
| 276 | + confirm: () => void = () => { | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + build() { | ||
| 280 | + Column() { | ||
| 281 | + | ||
| 282 | + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | ||
| 283 | + Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 284 | + .width(72) | ||
| 285 | + .height(29) | ||
| 286 | + Image($r('app.media.close_button')) | ||
| 287 | + .width(24) | ||
| 288 | + .onClick(() => { | ||
| 289 | + this.controller?.close() | ||
| 290 | + }) | ||
| 291 | + } | ||
| 292 | + .width('100%') | ||
| 293 | + .margin({ top: 30, bottom: 10 }) | ||
| 294 | + | ||
| 295 | + List() { | ||
| 296 | + | ||
| 297 | + ListItem() { | ||
| 298 | + Row() { | ||
| 299 | + Text(INDEX_SETTING_TITLE) | ||
| 300 | + .fontSize(16) | ||
| 301 | + .fontWeight(600) | ||
| 302 | + .margin({ right: 4 }) | ||
| 303 | + | ||
| 304 | + Text(INDEX_SETTING_SUBTITLE) | ||
| 305 | + .fontSize(12) | ||
| 306 | + .fontWeight(400) | ||
| 307 | + } | ||
| 308 | + .width('100%') | ||
| 309 | + .margin({ top: 22, bottom: 16 }) | ||
| 310 | + | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + ListItem() { | ||
| 314 | + Flex({ justifyContent: FlexAlign.SpaceBetween }) { | ||
| 315 | + ForEach(this.indexSettingArray, (text: string, index: number) => { | ||
| 316 | + Button(text, { type: ButtonType.Normal, stateEffect: false }) | ||
| 317 | + .width('48%') | ||
| 318 | + .borderRadius(2) | ||
| 319 | + .fontColor(index === this.indexSettingTabIndex ? '#ffffff' : '#ED2800') | ||
| 320 | + .fontSize(16) | ||
| 321 | + .fontWeight(400) | ||
| 322 | + .backgroundColor(index === this.indexSettingTabIndex ? '#ED2800' : '#FDE9E5') | ||
| 323 | + .onClick(() => { | ||
| 324 | + this.indexSettingTabIndex = index | ||
| 325 | + }) | ||
| 326 | + }) | ||
| 327 | + } | ||
| 328 | + .height(36) | ||
| 329 | + .margin({ bottom: 36 }) | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + ListItem() { | ||
| 333 | + Row() { | ||
| 334 | + Text(MY_CHANNEL) | ||
| 335 | + .fontSize(16) | ||
| 336 | + .fontWeight(600) | ||
| 337 | + Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT) | ||
| 338 | + .fontSize(14) | ||
| 339 | + .fontColor('#ED2800') | ||
| 340 | + .onClick(() => { | ||
| 341 | + this.isEditIng = !this.isEditIng | ||
| 342 | + }) | ||
| 343 | + } | ||
| 344 | + .width('100%') | ||
| 345 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 346 | + .margin({ bottom: 12 }) | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + ListItem() { | ||
| 350 | + GridRow({ columns: 4, gutter: 10 }) { | ||
| 351 | + ForEach(this.myChannelList, (item: TopNavDTO, index: number) => { | ||
| 352 | + GridCol() { | ||
| 353 | + Row() { | ||
| 354 | + Text(item.name) | ||
| 355 | + .fontSize(14) | ||
| 356 | + .fontColor(item.homeChannel === '1' ? '#999999': '#222222') | ||
| 357 | + | ||
| 358 | + if (this.isEditIng && item.myChannel !== '1') { | ||
| 359 | + Image($r('app.media.icon_audio_close')) | ||
| 360 | + .width(12) | ||
| 361 | + .margin({ left: 1 }) | ||
| 362 | + .onClick(() => { | ||
| 363 | + this.myChannelItemEditHandle(index) | ||
| 364 | + }) | ||
| 365 | + } | ||
| 366 | + } | ||
| 367 | + .width('100%').height('100%') | ||
| 368 | + .justifyContent(FlexAlign.Center) | ||
| 369 | + .backgroundColor(item.homeChannel === '1' ? '#F5F5F5': '') | ||
| 370 | + } | ||
| 371 | + .width(80) | ||
| 372 | + .height(40) | ||
| 373 | + .border({ | ||
| 374 | + width: item.homeChannel === '1' ? 0 : 1, | ||
| 375 | + color: '#EDEDED', | ||
| 376 | + radius: 3 | ||
| 377 | + }) | ||
| 378 | + }, (item: TopNavDTO) => JSON.stringify(item)) | ||
| 379 | + } | ||
| 380 | + .width('100%') | ||
| 381 | + .margin({ bottom: 24 }) | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + ListItem() { | ||
| 385 | + Column() { | ||
| 386 | + if (this.moreChannelList.length > 0) { | ||
| 387 | + Text(MORE_CHANNEL) | ||
| 388 | + .width('100%') | ||
| 389 | + .fontSize(16) | ||
| 390 | + .fontWeight(600) | ||
| 391 | + .margin({ bottom: 12 }) | ||
| 392 | + .textAlign(TextAlign.Start) | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + GridRow({ columns: 4, gutter: 10 }) { | ||
| 396 | + ForEach(this.moreChannelList, (item: TopNavDTO, index: number) => { | ||
| 397 | + GridCol() { | ||
| 398 | + Row() { | ||
| 399 | + Image($r('app.media.add_icon')) | ||
| 400 | + .width(12) | ||
| 401 | + .margin({ right: 1 }) | ||
| 402 | + .onClick(() => { | ||
| 403 | + this.myChannelList.push(this.moreChannelList.splice(index, 1)[0]) | ||
| 404 | + }) | ||
| 405 | + Text(item.name) | ||
| 406 | + .fontSize(14) | ||
| 407 | + } | ||
| 408 | + .width('100%').height('100%') | ||
| 409 | + .justifyContent(FlexAlign.Center) | ||
| 410 | + | ||
| 411 | + } | ||
| 412 | + .width(80) | ||
| 413 | + .height(40) | ||
| 414 | + .border({ | ||
| 415 | + width: 1, | ||
| 416 | + color: '#EDEDED' | ||
| 417 | + }) | ||
| 418 | + }, (item: TopNavDTO) => JSON.stringify(item)) | ||
| 419 | + } | ||
| 420 | + .width('100%') | ||
| 421 | + .margin({ bottom: 24 }) | ||
| 422 | + | ||
| 423 | + } | ||
| 424 | + .width('100%') | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + ListItem() { | ||
| 428 | + Column() { | ||
| 429 | + if (this.localChannelList.length > 0) { | ||
| 430 | + Text(LOCAL_CHANNEL) | ||
| 431 | + .width('100%') | ||
| 432 | + .fontSize(16) | ||
| 433 | + .fontWeight(600) | ||
| 434 | + .margin({ bottom: 12 }) | ||
| 435 | + .textAlign(TextAlign.Start) | ||
| 436 | + } | ||
| 437 | + | ||
| 438 | + GridRow({ columns: 4, gutter: 10 }) { | ||
| 439 | + ForEach(this.localChannelList, (item: TopNavDTO, index: number) => { | ||
| 440 | + GridCol() { | ||
| 441 | + Row() { | ||
| 442 | + Text(item.name) | ||
| 443 | + .fontSize(14) | ||
| 444 | + | ||
| 445 | + Image($r('app.media.add_icon')) | ||
| 446 | + .width(12) | ||
| 447 | + .margin({ left: 1 }) | ||
| 448 | + .onClick(() => { | ||
| 449 | + this.myChannelList.push(this.localChannelList.splice(index, 1)[0]) | ||
| 450 | + }) | ||
| 451 | + } | ||
| 452 | + .width('100%').height('100%') | ||
| 453 | + .justifyContent(FlexAlign.Center) | ||
| 454 | + | ||
| 455 | + } | ||
| 456 | + .width(80) | ||
| 457 | + .height(40) | ||
| 458 | + .border({ | ||
| 459 | + width: 1, | ||
| 460 | + color: '#EDEDED' | ||
| 461 | + }) | ||
| 462 | + }, (item: TopNavDTO) => JSON.stringify(item)) | ||
| 463 | + } | ||
| 464 | + .width('100%') | ||
| 465 | + .margin({ bottom: 24 }) | ||
| 466 | + } | ||
| 467 | + .width('100%') | ||
| 468 | + } | ||
| 469 | + | ||
| 470 | + }.width('100%').height('100%') | ||
| 471 | + | ||
| 472 | + } | ||
| 473 | + .padding(16) | ||
| 474 | + .backgroundColor('#ffffff') | ||
| 475 | + } | ||
| 476 | +} | ||
| 477 | + | ||
| 478 | +@Entry | ||
| 479 | +@Component | ||
| 480 | +struct ChannelSubscriptionLayout { | ||
| 481 | + @State textValue: string = '' | ||
| 482 | + @State inputValue: string = 'click me' | ||
| 483 | + dialogController: CustomDialogController | null = new CustomDialogController({ | ||
| 484 | + builder: CustomDialogExample({ | ||
| 485 | + cancel: () => { | ||
| 486 | + this.onCancel() | ||
| 487 | + }, | ||
| 488 | + confirm: () => { | ||
| 489 | + this.onAccept() | ||
| 490 | + }, | ||
| 491 | + }), | ||
| 492 | + cancel: this.exitApp, | ||
| 493 | + autoCancel: true, | ||
| 494 | + alignment: DialogAlignment.TopEnd, | ||
| 495 | + customStyle: true, | ||
| 496 | + }) | ||
| 497 | + | ||
| 498 | + aboutToDisappear() { | ||
| 499 | + this.dialogController = null // 将dialogController置空 | ||
| 500 | + } | ||
| 501 | + | ||
| 502 | + onCancel() { | ||
| 503 | + console.info('Callback when the first button is clicked') | ||
| 504 | + } | ||
| 505 | + | ||
| 506 | + onAccept() { | ||
| 507 | + console.info('Callback when the second button is clicked') | ||
| 508 | + } | ||
| 509 | + | ||
| 510 | + exitApp() { | ||
| 511 | + console.info('Click the callback in the blank area') | ||
| 512 | + } | ||
| 513 | + | ||
| 514 | + build() { | ||
| 515 | + Row() { | ||
| 516 | + Image($r('app.media.channel_button')) | ||
| 517 | + .onClick(() => { | ||
| 518 | + if (this.dialogController != null) { | ||
| 519 | + this.dialogController.open() | ||
| 520 | + } | ||
| 521 | + }).width($r('app.float.top_tab_bar_height')) | ||
| 522 | + }.backgroundColor('#ffffff') | ||
| 523 | + } | ||
| 524 | +} | ||
| 525 | + | ||
| 526 | +export { ChannelSubscriptionLayout } |
| @@ -2,7 +2,7 @@ import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; | @@ -2,7 +2,7 @@ import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; | ||
| 2 | import { LazyDataSource, Logger } from 'wdKit'; | 2 | import { LazyDataSource, Logger } from 'wdKit'; |
| 3 | import { WDRouterRule } from 'wdRouter'; | 3 | import { WDRouterRule } from 'wdRouter'; |
| 4 | import { PageComponent } from './PageComponent'; | 4 | import { PageComponent } from './PageComponent'; |
| 5 | - | 5 | +import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout' |
| 6 | const TAG = 'TopNavigationComponent'; | 6 | const TAG = 'TopNavigationComponent'; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| @@ -99,27 +99,32 @@ export struct TopNavigationComponent { | @@ -99,27 +99,32 @@ export struct TopNavigationComponent { | ||
| 99 | .width('100%') | 99 | .width('100%') |
| 100 | .height(40) | 100 | .height(40) |
| 101 | .visibility(this._currentNavIndex == 0 ? Visibility.Visible : Visibility.None) | 101 | .visibility(this._currentNavIndex == 0 ? Visibility.Visible : Visibility.None) |
| 102 | + Stack({alignContent:Alignment.TopEnd}){ | ||
| 102 | 103 | ||
| 103 | - Tabs() { | ||
| 104 | - ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { | ||
| 105 | - TabContent() { | ||
| 106 | - PageComponent({ | ||
| 107 | - currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 108 | - navIndex: index, | ||
| 109 | - pageId: navItem.pageId + '', | ||
| 110 | - channelId: navItem.channelId + '' | ||
| 111 | - }) | ||
| 112 | - } | ||
| 113 | - .tabBar(this.tabBarBuilder(navItem, index)) | ||
| 114 | - }, (navItem: TopNavDTO) => JSON.stringify(navItem)); | 104 | + Tabs() { |
| 105 | + ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { | ||
| 106 | + TabContent() { | ||
| 107 | + PageComponent({ | ||
| 108 | + currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 109 | + navIndex: index, | ||
| 110 | + pageId: navItem.pageId + '', | ||
| 111 | + channelId: navItem.channelId + '' | ||
| 112 | + }) | ||
| 113 | + } | ||
| 114 | + .tabBar(this.tabBarBuilder(navItem, index)) | ||
| 115 | + }, (navItem: TopNavDTO) => JSON.stringify(navItem)); | ||
| 116 | + } | ||
| 117 | + .barHeight($r('app.float.top_tab_bar_height')) | ||
| 118 | + .barMode(BarMode.Scrollable) | ||
| 119 | + .vertical(false) | ||
| 120 | + .onChange((index: number) => { | ||
| 121 | + Logger.info(TAG, `onChange index : ${index}`); | ||
| 122 | + this.currentTopNavSelectedIndex = index; | ||
| 123 | + }) | ||
| 124 | + | ||
| 125 | + ChannelSubscriptionLayout() | ||
| 115 | } | 126 | } |
| 116 | - .barHeight($r('app.float.top_tab_bar_height')) | ||
| 117 | - .barMode(BarMode.Scrollable) | ||
| 118 | - .vertical(false) | ||
| 119 | - .onChange((index: number) => { | ||
| 120 | - Logger.info(TAG, `onChange index : ${index}`); | ||
| 121 | - this.currentTopNavSelectedIndex = index; | ||
| 122 | - }) | 127 | + |
| 123 | } | 128 | } |
| 124 | } | 129 | } |
| 125 | 130 |
248 Bytes
314 Bytes
617 Bytes
-
Please register or login to post a comment