Match-id-977b8ef12a4b099ecca12564c3063b508f3e3b82

This commit is contained in:
* 2022-03-10 16:54:28 +08:00 committed by *
parent 885af8cb79
commit 6fa1fdb46d
1 changed files with 3 additions and 0 deletions

View File

@ -10,11 +10,14 @@ const uniqueKeyMap = new Map([
['Del', 'Delete'], ['Del', 'Delete'],
]); ]);
const noop = () => {};
// 创建普通自定义事件对象实例,和原生事件对应 // 创建普通自定义事件对象实例,和原生事件对应
export function decorateNativeEvent(customEventName, nativeEvtName, nativeEvent) { export function decorateNativeEvent(customEventName, nativeEvtName, nativeEvent) {
nativeEvent.isDefaultPrevented = () => nativeEvent.defaultPrevented; nativeEvent.isDefaultPrevented = () => nativeEvent.defaultPrevented;
nativeEvent.isPropagationStopped = () => nativeEvent.cancelBubble; nativeEvent.isPropagationStopped = () => nativeEvent.cancelBubble;
// 适配React16事件api
nativeEvent.persist = noop;
// custom事件自定义属性 // custom事件自定义属性
nativeEvent.customEventName = customEventName; nativeEvent.customEventName = customEventName;