From d68c460479cfabb3d9d9c50ee389a939b831dbf8 Mon Sep 17 00:00:00 2001 From: WX1379483 Date: Fri, 30 May 2025 17:10:08 +0800 Subject: [PATCH] =?UTF-8?q?feat=20(=E6=A0=87=E8=AF=86):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9HMRouter=E4=BB=93=E5=BA=93=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ets/component/product/ProductContent.ets | 6 ------ .../product/elements/ProductContent.ets | 17 +++++++++++++++++ .../src/main/ets/lifecycle/ExitAppLifecycle.ets | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 entry/src/main/ets/component/product/elements/ProductContent.ets diff --git a/entry/src/main/ets/component/product/ProductContent.ets b/entry/src/main/ets/component/product/ProductContent.ets index bcdc560..b2b11fd 100644 --- a/entry/src/main/ets/component/product/ProductContent.ets +++ b/entry/src/main/ets/component/product/ProductContent.ets @@ -26,17 +26,14 @@ interface ParamsType {} // [Start hm_router] @HMRouter({pageUrl: 'ProductContent'}) - // [Start page_url] @Component export struct ProductContent { // [StartExclude hm_router] - // [StartExclude page_url] // [StartExclude hm_router_get_current_param] @State product: ProductMsg = new ProductMsg(DetailConstants.COLOR_SELECT_NAME_LIST[0], DetailConstants.CAPACITY_SELECT_NAME_LIST[0], DetailConstants.PRODUCT_PRICE_NAMES[1]); // [EndExclude hm_router_get_current_param] - // [EndExclude page_url] // [EndExclude hm_router] @State param: ParamsType | null = null; @@ -44,7 +41,6 @@ export struct ProductContent { this.param = HMRouterMgr.getCurrentParam() as ParamsType; } // [StartExclude hm_router] - // [StartExclude page_url] // [StartExclude hm_router_get_current_param] build() { Column() { @@ -67,8 +63,6 @@ export struct ProductContent { } // [EndExclude hm_router] // [EndExclude hm_router_get_current_param] - // [EndExclude page_url] } // [End hm_router] -// [End page_url] // [End hm_router_get_current_param] \ No newline at end of file diff --git a/entry/src/main/ets/component/product/elements/ProductContent.ets b/entry/src/main/ets/component/product/elements/ProductContent.ets new file mode 100644 index 0000000..33fcf66 --- /dev/null +++ b/entry/src/main/ets/component/product/elements/ProductContent.ets @@ -0,0 +1,17 @@ +import { HMRouterMgr } from "@hadss/hmrouter"; +class ParamsType{ + +} +// [Start page_url] +@Component +export struct ProductContent { + // ... + @State param: ParamsType | null = null; + aboutToAppear(): void { + this.param = HMRouterMgr.getCurrentParam() as ParamsType; + } + // [StartExclude page_url] + build() {} + // [EndExclude page_url] +} +// [End page_url] diff --git a/entry/src/main/ets/lifecycle/ExitAppLifecycle.ets b/entry/src/main/ets/lifecycle/ExitAppLifecycle.ets index 42be9a6..4c317a0 100644 --- a/entry/src/main/ets/lifecycle/ExitAppLifecycle.ets +++ b/entry/src/main/ets/lifecycle/ExitAppLifecycle.ets @@ -29,7 +29,7 @@ export class ExitAppLifecycle implements IHMLifecycle { if(time - this.lastTime > 1000) { this.lastTime = time; ctx.uiContext.getPromptAction().showToast({ - message: '再次返回退出应用', + message: 'Return to exit the application again.', duration: 1000 }); return true; -- Gitee