yuzhilin

fix:解决 切换至版面返回时 页面空白问题

... ... @@ -64,6 +64,8 @@ export struct TopNavigationComponent {
@State indicatorLeftMargin: number = 0
@State indicatorWidth: number = 0
private tabsWidth: number = 0
//定时器延时处理切换至版面、播报tab时 返回上一个tab
@State tabTimmer: number = 0
topOrBottomNavChange() {
if (this.currentBottomNavName === this.currentBottomNavInfo?.name) {
... ... @@ -261,6 +263,9 @@ export struct TopNavigationComponent {
})
.animationDuration(this.animationDuration)
.onChange((index: number) => {
if(this.tabTimmer){
clearTimeout(this.tabTimmer)
}
this.currentTopNavName =
this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
Logger.info(TAG, `onChange index : ${index}`);
... ... @@ -272,11 +277,15 @@ export struct TopNavigationComponent {
if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
this.tabTimmer = setTimeout(() => {
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}, 500)
}
if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
ProcessUtils.gotoENewsPaper()
this.tabTimmer = setTimeout(() => {
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}, 500)
}
})
.onAnimationStart((index: number, targetIndex: number, event: TabsAnimationEvent) => {
... ...