diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index a3e7532aa29247117732fba3ea91deb225ce14da..de274d79bd74fed069c8be7c2584c4192a672c80 100644 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -2,7 +2,7 @@ "modelVersion": "5.0.0", "dependencies": { // "router-register-plugin":"1.8.0" - "router-register-plugin":"file:../plugins/router-register-plugin-1.8.2.tgz" + "router-register-plugin":"file:../plugins/router-register-plugin-1.8.2-beta.tgz" }, "execution": { // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ diff --git a/library/common/Index.ets b/library/common/Index.ets index d7ed16609d1aa34bec8d3ea13e8c178cded0a6ab..bd3e9f4c72e7a94613c27817c09a10382dc79d3a 100644 --- a/library/common/Index.ets +++ b/library/common/Index.ets @@ -1,5 +1,6 @@ export { MainPage } from './src/main/ets/components/MainPage' export { RouterConstants } from './src/main/ets/constants/RouterConstants' +export { RouterMap } from './src/main/ets/constants/RouterMap' export { KeyConst } from './src/main/ets/constants/KeyConst' export { commonTest } from './src/main/ets/constants/Test' export { IHarAService } from './src/main/ets/services/IHarAService' diff --git a/library/common/src/main/ets/constants/RouterMap.ets b/library/common/src/main/ets/constants/RouterMap.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4fbee9ef389b1ed4317a015566cffbc46d034f2 --- /dev/null +++ b/library/common/src/main/ets/constants/RouterMap.ets @@ -0,0 +1,21 @@ +/** + * 路由地址集 + */ +export namespace RouterMap { + + /** + * HapA + */ + export namespace HapA { + /** + * 模块名称 + */ + const GROUP = 'hapA/'; + /** + * 分组拼接路径 + */ + export const HAP_A_PAGE_ONE = GROUP + "hapAPageOne"; + + } + +} \ No newline at end of file diff --git a/plugins/router-register-plugin-1.8.2-beta.tgz b/plugins/router-register-plugin-1.8.2-beta.tgz new file mode 100644 index 0000000000000000000000000000000000000000..1ae8bd3043ed2af1d6baabca13a9f41e986c5c35 Binary files /dev/null and b/plugins/router-register-plugin-1.8.2-beta.tgz differ diff --git a/products/hapA/src/main/ets/pages/HapPageOne.ets b/products/hapA/src/main/ets/pages/HapPageOne.ets index 7caffa2f0594c1593730e02bfc0df0df69999eed..b4d59c1894f85a5e80b068958587cb3e03e598cf 100644 --- a/products/hapA/src/main/ets/pages/HapPageOne.ets +++ b/products/hapA/src/main/ets/pages/HapPageOne.ets @@ -1,7 +1,8 @@ import { Route } from "@hzw/zrouter"; -import { RouterConstants } from "common_library"; +import { RouterConstants, RouterMap } from "common_library"; -@Route({name: RouterConstants.HAP_A_PAGE_ONE}) +// @Route({name: RouterConstants.HAP_A_PAGE_ONE}) +@Route({name: RouterMap.HapA.HAP_A_PAGE_ONE}) @Component export struct HapPageOne { build() { diff --git a/products/hapA/src/main/ets/pages/Index.ets b/products/hapA/src/main/ets/pages/Index.ets index bf5b409efb80e12189f3f127a4863debe6a1a593..6ada8d49a301b93983aa42f1be7ea97e4ed24917 100644 --- a/products/hapA/src/main/ets/pages/Index.ets +++ b/products/hapA/src/main/ets/pages/Index.ets @@ -1,4 +1,4 @@ -import { RouterConstants } from 'common_library'; +import { RouterConstants, RouterMap } from 'common_library'; import { common } from '@kit.AbilityKit'; import { Logger } from '@hzw/logger'; import { ZRouter } from '@hzw/zrouter'; @@ -17,7 +17,7 @@ struct Index { Navigation(ZRouter.getNavStackByName(RouterConstants.HAP)) { Column({ space: 20 }) { Button("toHapPageOne").onClick((event: ClickEvent) => { - ZRouter.getInstance(RouterConstants.HAP).navigation(RouterConstants.HAP_A_PAGE_ONE) + ZRouter.getInstance(RouterConstants.HAP).navigation(RouterMap.HapA.HAP_A_PAGE_ONE) }) } }.onAppear(() => {