zhenghy

解决频道切换页面销毁

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