在HarmonyOS NEXT开发中Navigation是否有办法类似Router中的RouterMode实现单例模式?

在HarmonyOS NEXT开发中Navigation是否有办法类似Router中的RouterMode实现单例模式?

阅读 817
1 个回答

参考demo:

pushPathsingleTask(info: NavPathInfo, animated?: boolean): void { 
  this.pageArray =[] 
  this.pageArray = this.pageInfos.getIndexByName(info.name) 
  if(this.pageArray.length == 0){ 
  this.pageInfos.pushPath(info, animated)return; 
} 
this.pageInfos.popToIndex(this.pageArray.pop(), animated) 
}