共享har或者hsp包的跳转,使用router.replaceNamedRoute路由名称跳转(共享包里面的页面,不需要再main\_pages里面配置)。参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-routing-V5【entry跳har/hsp】import router from ‘@ohos.router’; import(‘library/src/main/ets/pages/Index’) // 引入共享包中的命名路由页面,如果存在红色波浪线,不影响编译打包 @Entry @Component struct Index { build() { Text(‘点击’).onclick(()=>{ router.pushNamedRoute({ name: ‘harA’ }) }) } }【harA跳转harB】@Entry({ routeName : ‘harA’ }) @Component export struct HarA { } @Entry({ routeName : ‘harA’ }) @Component export struct HarA { build() { Text(‘点击’).onclick(()=>{ router.pushNamedRoute({ name: ‘harB’ }) }) } } @Entry({ routeName : ‘harB’ }) @Component export struct HarB { }由于router不演进,建议采用Navgation作为导航容器:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-navigation-navigation-V5不同模块(har/hsp)页面跳转依赖问题,推荐使用Navigation去实现多模块路由管理和模块间解耦。参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-navigation-navigation-V5navigation跨包动态路由:https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/arkts-navigation-navigation.md\#%E8%B7%A8%E5%8C%85%E5%8A%A8%E6%80%81%E8%B7%AF%E7%94%B1
共享har或者hsp包的跳转,使用router.replaceNamedRoute路由名称跳转(共享包里面的页面,不需要再main\_pages里面配置)。
参考链接:
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-routing-V5
【entry跳har/hsp】
【harA跳转harB】
由于router不演进,建议采用Navgation作为导航容器:
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-navigation-navigation-V5
不同模块(har/hsp)页面跳转依赖问题,推荐使用Navigation去实现多模块路由管理和模块间解耦。
参考文档:
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-navigation-navigation-V5
navigation跨包动态路由:
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/arkts-navigation-navigation.md\#%E8%B7%A8%E5%8C%85%E5%8A%A8%E6%80%81%E8%B7%AF%E7%94%B1