diff --git a/ArkUI/entry/src/main/ets/pages/JumpPageTransferParameters.ets b/ArkUI/entry/src/main/ets/pages/JumpPageTransferParameters.ets index 0e052b3d235128ad5f238015d672dfe0e42c2241..56bb6c687939a053df20d2e7cd14e35ced0e0f60 100644 --- a/ArkUI/entry/src/main/ets/pages/JumpPageTransferParameters.ets +++ b/ArkUI/entry/src/main/ets/pages/JumpPageTransferParameters.ets @@ -74,7 +74,11 @@ export struct MyFirstNavDestination { } .height('100%') .onClick(() => { - this.pathInfos.pushPathByName('MySecondNavDestination', null); + this.pathInfos.pushPath({ + name: 'MySecondNavDestination', param: null, onPop: (popInfo: PopInfo) => { + console.info(`[pushPath]last page is: ${popInfo.info.name},result: ${JSON.stringify(popInfo.result)}`); + } + }); }) }.onShown(() => { this.getParamsPrint(); @@ -94,20 +98,10 @@ export struct MySecondNavDestination { } .height('100%') }.onBackPressed(() => { - // Pop B page. - this.pathInfos.pop(); - - //Get the name of the current stack top page (page A). - let allPathName: Array = this.pathInfos.getAllPathName(); - let pathNameA: string = allPathName[allPathName.length - 1]; - - // Pop A page. - this.pathInfos.pop(); - - // PUSH A page again. - this.pathInfos.pushPath(new NavPathInfo(pathNameA, this.routerParams)) + this.pathInfos.pop(this.routerParams); return true; }) } } + // [End jump_page_transfer_parameters] \ No newline at end of file