From 2263dbe5f7082a5c4bfdc92c1d7bb5f71cb7d9bb Mon Sep 17 00:00:00 2001 From: wids1356 Date: Fri, 28 Dec 2018 14:50:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BaseEvent=E6=B7=BB=E5=8A=A0=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E5=B8=B8=E7=94=A8=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 阻止默认行为和阻止事件冒泡的函数 --- packages/taro-components/types/common.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/taro-components/types/common.d.ts b/packages/taro-components/types/common.d.ts index 4d7fda31ad85..e1c2e4d0ef27 100644 --- a/packages/taro-components/types/common.d.ts +++ b/packages/taro-components/types/common.d.ts @@ -129,7 +129,17 @@ interface BaseEvent { /** * 额外的信息 */ - detail: any + detail: any, + + /** + * 阻止元素发生默认的行为 + */ + preventDefault: () => void; + + /** + * 阻止事件冒泡到父元素,阻止任何父事件处理程序被执行 + */ + stopPropagation: () => void; } interface ITouchEvent extends BaseEvent { From 95a5ac2dc14f041b31a01b5921314c0df85572f5 Mon Sep 17 00:00:00 2001 From: wids1356 Date: Fri, 28 Dec 2018 14:52:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BC=BA=E8=BF=AB=E7=97=87=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=AD=E5=8F=A5=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-components/types/common.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/taro-components/types/common.d.ts b/packages/taro-components/types/common.d.ts index e1c2e4d0ef27..8f4ea146fc0f 100644 --- a/packages/taro-components/types/common.d.ts +++ b/packages/taro-components/types/common.d.ts @@ -134,12 +134,12 @@ interface BaseEvent { /** * 阻止元素发生默认的行为 */ - preventDefault: () => void; + preventDefault: () => void, /** * 阻止事件冒泡到父元素,阻止任何父事件处理程序被执行 */ - stopPropagation: () => void; + stopPropagation: () => void } interface ITouchEvent extends BaseEvent {