From 7e2d37eb61d0dea06e870fc5ac7ca6fda32b14a6 Mon Sep 17 00:00:00 2001 From: ywcoder <1104410818@qq.com> Date: Tue, 9 Dec 2025 11:00:31 +0800 Subject: [PATCH] =?UTF-8?q?FAQ=E4=BB=A3=E7=A0=81=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ets/pages/JumpPageTransferParameters.ets | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/ArkUI/entry/src/main/ets/pages/JumpPageTransferParameters.ets b/ArkUI/entry/src/main/ets/pages/JumpPageTransferParameters.ets index 0e052b3..56bb6c6 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 -- Gitee