From 6fa1fdb46df200c61987684ee844911d3f304c51 Mon Sep 17 00:00:00 2001 From: * <8> Date: Thu, 10 Mar 2022 16:54:28 +0800 Subject: [PATCH] Match-id-977b8ef12a4b099ecca12564c3063b508f3e3b82 --- libs/horizon/src/event/customEvents/EventFactory.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/horizon/src/event/customEvents/EventFactory.ts b/libs/horizon/src/event/customEvents/EventFactory.ts index db6bfc17..3bad01d4 100644 --- a/libs/horizon/src/event/customEvents/EventFactory.ts +++ b/libs/horizon/src/event/customEvents/EventFactory.ts @@ -10,11 +10,14 @@ const uniqueKeyMap = new Map([ ['Del', 'Delete'], ]); +const noop = () => {}; // 创建普通自定义事件对象实例,和原生事件对应 export function decorateNativeEvent(customEventName, nativeEvtName, nativeEvent) { nativeEvent.isDefaultPrevented = () => nativeEvent.defaultPrevented; nativeEvent.isPropagationStopped = () => nativeEvent.cancelBubble; + // 适配React16事件api + nativeEvent.persist = noop; // custom事件自定义属性 nativeEvent.customEventName = customEventName;