HarmonyOS 无法跳转,也没log输出,无法定位问题

.onClick(() => {
  hilog.error(0xFF00, 'InterestMath', `%{public}s, %{public}s`, "befor pushPath ");
  this.navPathStack.pushPath({ name: 'MainActivity' });
  // this.navPathStack.pushPath({ name: './src/main/ets/pages/MainActivity' });
  hilog.error(0xFF00, 'InterestMath', `%{public}s, %{public}s`, "end pushPath ");
})
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.

这是我跳转的代码,用了名称或者完整路径都不行,没任何反应。我是按照开发者API 里面来写的呀。

关键是log里面就只有打印了我的 befor pushPath 和 end pushPath ,在这两个之间没有任何log提示。

无法跳转系统又不输出错误log,咱们开发者如何定位问题呢?

HarmonyOS
2024-12-26 14:25:20
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

可以参考以下文档:

https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-basic-components-navigation.md

https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-navigation-navigation-V5

Navigation跳转的demo如下:

@Entry
@Component
struct mainPageView {
  @Provide('pageStack') pageStack: NavPathStack = new NavPathStack()
  @Builder
  pageMap(pageName: string) {
    if (pageName === 'loginPage') {
      loginPageView()
    } else if (pageName === 'mainPage') {
      mainPageView()
    }
  }
  build() {
    Navigation(this.pageStack){
      ...
      Button('login').onClick( ent => {
        let pathInfo : NavPathInfo = new NavPathInfo('loginPage', null)
        this.pageStack.pushDestination(pathInfo, true);
      })
    }.navDestination(this.pageMap)
    ...
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
分享
微博
QQ
微信
回复
2024-12-26 16:33:45
相关问题
报错问题不全没法定位问题
749浏览 • 1回复 待解决
openharmony: hilog私有日志无法输出
12375浏览 • 3回复 待解决
HarmonyOS 跨模块无法跳转
594浏览 • 1回复 待解决
HarmonyOS router无法跳转,并报错。
907浏览 • 1回复 待解决
HarmonyOS 无法跳转电话拨号页面
397浏览 • 1回复 待解决
Page Ability 无法实现跳转
9403浏览 • 1回复 待解决
为什么跳转突然无法实现
2431浏览 • 0回复 待解决
HarmonyOS 动态路由无法在enrty跳转
257浏览 • 1回复 待解决
HarmonyOS C++的日志输出怎么在Log中显示
1229浏览 • 1回复 待解决
HarmonyOS 无法全屏问题
572浏览 • 1回复 待解决
场景化控件中无法获取到定位信息
2194浏览 • 1回复 待解决
HarmonyOS hap跳hsp页面无法跳转
625浏览 • 1回复 待解决