From 9013b9e2aa8cb867979f10a764a747f585bc752c Mon Sep 17 00:00:00 2001 From: ZhangQ <12903047+zq-kexin@user.noreply.gitee.com> Date: Thu, 4 Sep 2025 09:21:33 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=E5=90=8C=E6=BA=90sample=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ZhangQ <12903047+zq-kexin@user.noreply.gitee.com> --- NonSameLayerRendering/README.md | 44 +++++++++++++++++++ NonSameLayerRendering/build-profile.json5 | 3 +- .../main/ets/entryability/EntryAbility.ets | 15 +++++++ .../entrybackupability/EntryBackupAbility.ets | 15 +++++++ .../entry/src/main/ets/pages/Index.ets | 16 ++++++- .../hvigor/hvigor-config.json5 | 2 +- NonSameLayerRendering/oh-package.json5 | 2 +- 7 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 NonSameLayerRendering/README.md diff --git a/NonSameLayerRendering/README.md b/NonSameLayerRendering/README.md new file mode 100644 index 00000000..d66c1b0c --- /dev/null +++ b/NonSameLayerRendering/README.md @@ -0,0 +1,44 @@ +# 同层渲染原生组件 + +### 介绍 + +在使用Web组件加载H5页面时,经常会有输入框、视频的场景,这些场景在H5中的组件性能体验欠佳。想要更加流畅的体验,必须要将原生组件放到Web组件上。 +本工程配套官网[同层渲染原生组件](https://developer.huawei.com/consumer/cn/doc/best-practices/bpta-render-web-using-same-layer-render), +文章介绍如何在Web组件上使用原生组件同层渲染。 + +### 预览效果 + +![image](screenshots/render.gif) + +### 使用说明 + +1. 打开应用,抓取Trace图分析。 +2. 上下滑动商品列表,抓取Trace图分析。 + +### 工程目录 + +``` +├──entry/src/main/ets +│ ├──entryability +│ │ └──EntryAbility.ets // 程序入口类 +│ ├──entrybackupability +│ │ └──EntryBackupAbility.ets // 自定义应用数据转换和迁移模板类 +│ ├──mock +│ │ └──GoodsMock.ets // 构造页面脏数据 +│ ├──model +│ │ └──GoodsModel.ets // 商品数据结构 +│ └──pages +│ └──Index.ets // 应用首页同层渲染 +└──entry/src/main/resources // 应用资源目录 +``` + +### 相关权限 + +不涉及 + +### 约束与限制 + +* 本示例仅支持标准系统上运行,支持设备:华为手机。 +* HarmonyOS系统:HarmonyOS 5.0.5 Release及以上。 +* DevEco Studio版本:DevEco Studio 5.0.5 Release及以上。 +* HarmonyOS SDK版本:HarmonyOS 5.0.5 Release SDK及以上。 \ No newline at end of file diff --git a/NonSameLayerRendering/build-profile.json5 b/NonSameLayerRendering/build-profile.json5 index c033ce42..b2ca56e3 100644 --- a/NonSameLayerRendering/build-profile.json5 +++ b/NonSameLayerRendering/build-profile.json5 @@ -5,7 +5,8 @@ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "5.0.0(12)", + "compatibleSdkVersion": "5.0.5(17)", + "targetSdkVersion": "5.0.5(17)", "runtimeOS": "HarmonyOS", } ], diff --git a/NonSameLayerRendering/entry/src/main/ets/entryability/EntryAbility.ets b/NonSameLayerRendering/entry/src/main/ets/entryability/EntryAbility.ets index 4acdf913..631333d0 100644 --- a/NonSameLayerRendering/entry/src/main/ets/entryability/EntryAbility.ets +++ b/NonSameLayerRendering/entry/src/main/ets/entryability/EntryAbility.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { window } from '@kit.ArkUI'; diff --git a/NonSameLayerRendering/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/NonSameLayerRendering/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets index dc55c03d..6b744d7e 100644 --- a/NonSameLayerRendering/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +++ b/NonSameLayerRendering/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hilog } from '@kit.PerformanceAnalysisKit'; import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; diff --git a/NonSameLayerRendering/entry/src/main/ets/pages/Index.ets b/NonSameLayerRendering/entry/src/main/ets/pages/Index.ets index 513ed372..c6d374fa 100644 --- a/NonSameLayerRendering/entry/src/main/ets/pages/Index.ets +++ b/NonSameLayerRendering/entry/src/main/ets/pages/Index.ets @@ -1,5 +1,19 @@ +/* + * Copyright (c) 2024 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + // [Start non_same_layer_rendering] -import { promptAction } from '@kit.ArkUI'; import { PRODUCT_DATA } from '../mock/GoodsMock'; import { webview } from '@kit.ArkWeb'; diff --git a/NonSameLayerRendering/hvigor/hvigor-config.json5 b/NonSameLayerRendering/hvigor/hvigor-config.json5 index 2662c041..783acc70 100644 --- a/NonSameLayerRendering/hvigor/hvigor-config.json5 +++ b/NonSameLayerRendering/hvigor/hvigor-config.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "dependencies": { }, "execution": { diff --git a/NonSameLayerRendering/oh-package.json5 b/NonSameLayerRendering/oh-package.json5 index f3884ebe..23072fe3 100644 --- a/NonSameLayerRendering/oh-package.json5 +++ b/NonSameLayerRendering/oh-package.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "description": "Please describe the basic information.", "dependencies": { }, -- Gitee From adf0bddb1bf86e2317be2af9ff95af9c74b1a861 Mon Sep 17 00:00:00 2001 From: ZhangQ <12903047+zq-kexin@user.noreply.gitee.com> Date: Thu, 4 Sep 2025 09:28:10 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=E5=90=8C=E6=BA=90sample=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ZhangQ <12903047+zq-kexin@user.noreply.gitee.com> --- FramedRendering/build-profile.json5 | 3 ++- FramedRendering/hvigor/hvigor-config.json5 | 2 +- FramedRendering/oh-package.json5 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FramedRendering/build-profile.json5 b/FramedRendering/build-profile.json5 index 6d93d9cd..b8ef59a1 100644 --- a/FramedRendering/build-profile.json5 +++ b/FramedRendering/build-profile.json5 @@ -4,7 +4,8 @@ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "5.0.0(12)", + "compatibleSdkVersion": "5.0.5(17)", + "targetSdkVersion": "5.0.5(17)", "runtimeOS": "HarmonyOS", "buildOption": { "strictMode": { diff --git a/FramedRendering/hvigor/hvigor-config.json5 b/FramedRendering/hvigor/hvigor-config.json5 index 06b27836..5bebc975 100644 --- a/FramedRendering/hvigor/hvigor-config.json5 +++ b/FramedRendering/hvigor/hvigor-config.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "dependencies": { }, "execution": { diff --git a/FramedRendering/oh-package.json5 b/FramedRendering/oh-package.json5 index b0fd4f4f..b4040e84 100644 --- a/FramedRendering/oh-package.json5 +++ b/FramedRendering/oh-package.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "description": "Please describe the basic information.", "dependencies": { "lunar_lite": "^1.0.0" -- Gitee From f53e7e516c32a0676df1848e2ecd546355c8c093 Mon Sep 17 00:00:00 2001 From: ZhangQ <12903047+zq-kexin@user.noreply.gitee.com> Date: Thu, 4 Sep 2025 09:35:28 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=E5=90=8C=E6=BA=90sample=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ZhangQ <12903047+zq-kexin@user.noreply.gitee.com> --- TextureHypercompression/build-profile.json5 | 3 ++- .../src/main/ets/entryability/EntryAbility.ets | 15 +++++++++++++++ .../entry/src/main/ets/pages/Index.ets | 15 +++++++++++++++ .../hvigor/hvigor-config.json5 | 2 +- TextureHypercompression/oh-package.json5 | 2 +- 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/TextureHypercompression/build-profile.json5 b/TextureHypercompression/build-profile.json5 index 6409e9d6..4a6f5bba 100644 --- a/TextureHypercompression/build-profile.json5 +++ b/TextureHypercompression/build-profile.json5 @@ -5,7 +5,8 @@ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "5.0.0(12)", + "compatibleSdkVersion": "5.0.5(17)", + "targetSdkVersion": "5.0.5(17)", "runtimeOS": "HarmonyOS", } ], diff --git a/TextureHypercompression/entry/src/main/ets/entryability/EntryAbility.ets b/TextureHypercompression/entry/src/main/ets/entryability/EntryAbility.ets index 4acdf913..d15033a3 100644 --- a/TextureHypercompression/entry/src/main/ets/entryability/EntryAbility.ets +++ b/TextureHypercompression/entry/src/main/ets/entryability/EntryAbility.ets @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2024 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 +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { window } from '@kit.ArkUI'; diff --git a/TextureHypercompression/entry/src/main/ets/pages/Index.ets b/TextureHypercompression/entry/src/main/ets/pages/Index.ets index 0b55fdac..492142a7 100644 --- a/TextureHypercompression/entry/src/main/ets/pages/Index.ets +++ b/TextureHypercompression/entry/src/main/ets/pages/Index.ets @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2024 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 +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + @Entry @Component struct TabsExample { diff --git a/TextureHypercompression/hvigor/hvigor-config.json5 b/TextureHypercompression/hvigor/hvigor-config.json5 index 2662c041..783acc70 100644 --- a/TextureHypercompression/hvigor/hvigor-config.json5 +++ b/TextureHypercompression/hvigor/hvigor-config.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "dependencies": { }, "execution": { diff --git a/TextureHypercompression/oh-package.json5 b/TextureHypercompression/oh-package.json5 index 60a170aa..35e74b85 100644 --- a/TextureHypercompression/oh-package.json5 +++ b/TextureHypercompression/oh-package.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "description": "Please describe the basic information.", "dependencies": { }, -- Gitee