yuzhilin

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

@@ -64,6 +64,8 @@ export struct TopNavigationComponent { @@ -64,6 +64,8 @@ export struct TopNavigationComponent {
64 @State indicatorLeftMargin: number = 0 64 @State indicatorLeftMargin: number = 0
65 @State indicatorWidth: number = 0 65 @State indicatorWidth: number = 0
66 private tabsWidth: number = 0 66 private tabsWidth: number = 0
  67 + //定时器延时处理切换至版面、播报tab时 返回上一个tab
  68 + @State tabTimmer: number = 0
67 69
68 topOrBottomNavChange() { 70 topOrBottomNavChange() {
69 if (this.currentBottomNavName === this.currentBottomNavInfo?.name) { 71 if (this.currentBottomNavName === this.currentBottomNavInfo?.name) {
@@ -261,6 +263,9 @@ export struct TopNavigationComponent { @@ -261,6 +263,9 @@ export struct TopNavigationComponent {
261 }) 263 })
262 .animationDuration(this.animationDuration) 264 .animationDuration(this.animationDuration)
263 .onChange((index: number) => { 265 .onChange((index: number) => {
  266 + if(this.tabTimmer){
  267 + clearTimeout(this.tabTimmer)
  268 + }
264 this.currentTopNavName = 269 this.currentTopNavName =
265 this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name 270 this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
266 Logger.info(TAG, `onChange index : ${index}`); 271 Logger.info(TAG, `onChange index : ${index}`);
@@ -272,11 +277,15 @@ export struct TopNavigationComponent { @@ -272,11 +277,15 @@ export struct TopNavigationComponent {
272 if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { 277 if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
273 // 跳转到播报页面 278 // 跳转到播报页面
274 ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) 279 ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
275 - this.tabsController.changeIndex(this.currentTopNavSelectedIndex) 280 + this.tabTimmer = setTimeout(() => {
  281 + this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
  282 + }, 500)
276 } 283 }
277 if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { 284 if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
278 ProcessUtils.gotoENewsPaper() 285 ProcessUtils.gotoENewsPaper()
279 - this.tabsController.changeIndex(this.currentTopNavSelectedIndex) 286 + this.tabTimmer = setTimeout(() => {
  287 + this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
  288 + }, 500)
280 } 289 }
281 }) 290 })
282 .onAnimationStart((index: number, targetIndex: number, event: TabsAnimationEvent) => { 291 .onAnimationStart((index: number, targetIndex: number, event: TabsAnimationEvent) => {