From 6e5dcb276343fe7506b18dc25cf8e9df83f6f886 Mon Sep 17 00:00:00 2001 From: yuandongping Date: Tue, 1 Jul 2025 09:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=BB=E9=A1=B5=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=AF=A6=E6=83=85=E8=BD=AC=E5=9C=BA=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yuandongping --- .../src/main/ets/main/DetailPage.ets | 4 ++-- .../src/main/ets/components/good/GoodsList.ets | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/main/DetailPage.ets b/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/main/DetailPage.ets index 3be0fb2986..fb01cb8e91 100644 --- a/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/main/DetailPage.ets +++ b/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/main/DetailPage.ets @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023 Huawei Device Co., Ltd. +* Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -246,7 +246,7 @@ export struct DetailPage { Column() { Image(this.goodDetailData.uri) .objectFit(ImageFit.Contain) - .sharedTransition('goods' + this.goodDetailData.id, { duration: 600, curve: Curve.Linear, delay: 100 }) + .geometryTransition('goods' + this.goodDetailData.id, { follow: true }) .onComplete(() => { setTimeout(() => { this.isShowImage = false; diff --git a/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/good/GoodsList.ets b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/good/GoodsList.ets index ea33461230..1e57f48622 100644 --- a/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/good/GoodsList.ets +++ b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/good/GoodsList.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -56,7 +56,7 @@ export struct GoodsList { }) { Column() { - // 方案二:使用router跳转页面,配合共享元素动画 + // 方案二:使用nav跳转页面,配合共享元素动画 Image(item.uri) .id('goods' + item.id) .width('70%') @@ -64,7 +64,7 @@ export struct GoodsList { .clip(true) .objectFit(ImageFit.Contain) .margin({ bottom: 12 }) - .sharedTransition('goods' + item.id, { duration: 600, curve: Curve.Linear, delay: 100 }) + .geometryTransition('goods' + item.id, { follow: true }) Column() { Text(item.title) @@ -112,13 +112,15 @@ export struct GoodsList { .padding(12) .backgroundColor($r('app.color.white')) - // 方案二:使用正常router跳转,配合共享元素动画 + // 方案二:使用nav跳转,配合共享元素动画 .onClick(() => { // 动态加载组件 - DynamicLoader.getInstance().fire('DetailPage').then(()=>{ - this.active = true; - this.pageStack.pushPathByName('DetailPage', item); - }) + this.getUIContext()?.animateTo({ duration: 600, curve: Curve.Linear }, () => { + DynamicLoader.getInstance().fire('DetailPage').then(() => { + this.active = true; + this.pageStack.pushPathByName('DetailPage', item, false); + }) + }); }) } }, (item: Info | ProductDataModel): string => item.id.toString()) -- Gitee