From c087efb332b182b35c01373cb8dd0406ccff5655 Mon Sep 17 00:00:00 2001 From: "@feng-yu4279" Date: Wed, 28 May 2025 17:06:45 +0800 Subject: [PATCH] =?UTF-8?q?feat=20(=E6=A0=87=E8=AF=86):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20ComponentEncapsulation=20=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/pages/GesturesConflictScene8.ets | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 GesturesConfictPractice/entry/src/main/ets/pages/GesturesConflictScene8.ets diff --git a/GesturesConfictPractice/entry/src/main/ets/pages/GesturesConflictScene8.ets b/GesturesConfictPractice/entry/src/main/ets/pages/GesturesConflictScene8.ets new file mode 100644 index 00000000..6345f0e5 --- /dev/null +++ b/GesturesConfictPractice/entry/src/main/ets/pages/GesturesConflictScene8.ets @@ -0,0 +1,50 @@ +/* +* 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 component_scene4] +@Entry +@Component +struct GesturesConflictScene4 { + build() { + Stack() { + Column()//Underlying Column + .width('100%') + .height('100%') + .backgroundColor(Color.Black) + .gesture( + SwipeGesture({ direction: SwipeDirection.Horizontal })//Horizontal swipe gesture + .onAction((event) => { + if (event) { + console.info('Column SwipeGesture'); + } + }) + ) + Column()//Upper Column + .width(300) + .height(100) + .backgroundColor(Color.Red) + .hitTestBehavior(HitTestMode.None) + } + .width(300) + .height(300) + } +} +// [End component_scene4] \ No newline at end of file -- Gitee