HarmonyOS 返回原页面如何获取传递的参数

NavPathStack.pop(result:Object,ano?:boolean)方法返回上一层页面时,如何在上一层页面中获取传递回来的的这个result对象,这个result对象是否是回传的数据

HarmonyOS
2024-12-25 08:11:14
296浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
Excelsior_abit

上层页面是如何跳转的 例:pushPath 入参有onPop回调 该回调可获取

Button('pushPath', { stateEffect: true, type: ButtonType.Capsule })
  .width('80%')
  .height(40)
  .margin(20)
  .onClick(() => {
    this.pageInfos.pushPath({ name: 'pageOne',onPop: (popInfo: PopInfo)=>{
      JSON.stringify("popInfo.result::"+popInfo.result)
      console.log('onPop回调执行了');
    } }) //将name指定的NavDestination页面信息入栈
  })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
分享
微博
QQ
微信
回复
2024-12-25 10:08:57
相关问题
返回页面router.back如何传递参数
1613浏览 • 2回复 待解决
HarmonyOS 页面如何禁止手势返回
817浏览 • 1回复 待解决
如何获取router.back传递参数
3575浏览 • 1回复 待解决
原生页面和webview如何进行参数传递
1220浏览 • 1回复 待解决
页面传递参数总是闪退
264浏览 • 0回复 待解决
HarmonyOS rest参数如何传递
892浏览 • 1回复 待解决