zhenghy

解决频道切换页面销毁

@@ -68,6 +68,7 @@ export struct BottomNavigationComponent { @@ -68,6 +68,7 @@ export struct BottomNavigationComponent {
68 groupId: navItem.id, 68 groupId: navItem.id,
69 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), 69 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
70 _currentNavIndex: this.currentNavIndex, 70 _currentNavIndex: this.currentNavIndex,
  71 + currentBottomNavName: navItem.name,
71 changeBarBackgroundColor: (color: Color) => { 72 changeBarBackgroundColor: (color: Color) => {
72 this.barBackgroundColor = color 73 this.barBackgroundColor = color
73 } 74 }
@@ -80,6 +81,7 @@ export struct BottomNavigationComponent { @@ -80,6 +81,7 @@ export struct BottomNavigationComponent {
80 }); 81 });
81 82
82 } 83 }
  84 + .animationDuration(0)
83 .barHeight($r('app.float.bottom_navigation_barHeight')) 85 .barHeight($r('app.float.bottom_navigation_barHeight'))
84 .barMode(BarMode.Fixed) 86 .barMode(BarMode.Fixed)
85 // TODO:更详细的判断是视频频道 87 // TODO:更详细的判断是视频频道
@@ -22,6 +22,7 @@ const storage = LocalStorage.getShared(); @@ -22,6 +22,7 @@ const storage = LocalStorage.getShared();
22 @Component 22 @Component
23 export struct TopNavigationComponent { 23 export struct TopNavigationComponent {
24 private groupId: number = 0 24 private groupId: number = 0
  25 + private currentBottomNavName: string = ''
25 private tabsController: TabsController = new TabsController() 26 private tabsController: TabsController = new TabsController()
26 private changeBarBackgroundColor: (color: Color) => void = () => { 27 private changeBarBackgroundColor: (color: Color) => void = () => {
27 } 28 }
@@ -225,9 +226,9 @@ export struct TopNavigationComponent { @@ -225,9 +226,9 @@ export struct TopNavigationComponent {
225 // 频道分类list 226 // 频道分类list
226 Stack({ alignContent: Alignment.TopEnd }) { 227 Stack({ alignContent: Alignment.TopEnd }) {
227 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { 228 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
228 - ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => { 229 + ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
229 TabContent() { 230 TabContent() {
230 - if (this._currentNavIndex === 2 && navItem.name === '视频') { 231 + if (this.currentBottomNavName === '视频' && navItem.name === '视频') {
231 VideoChannelDetail({ 232 VideoChannelDetail({
232 bottomNavIndex: this._currentNavIndex, 233 bottomNavIndex: this._currentNavIndex,
233 topNavIndex: this.currentTopNavSelectedIndex, 234 topNavIndex: this.currentTopNavSelectedIndex,