Match-id-6c100f1d01da9e17e32d09176e40d5da6087ede5
This commit is contained in:
parent
b69ebe308a
commit
7b4a54c2e6
|
@ -25,6 +25,9 @@ export class WrappedEvent {
|
|||
stopPropagation: () => void;
|
||||
preventDefault: () => void;
|
||||
|
||||
propagationStopped = false
|
||||
isPropagationStopped = (): boolean => this.propagationStopped;
|
||||
|
||||
// 适配Keyboard键盘事件该函数不能由合成事件调用
|
||||
getModifierState?: (keyArgs: string) => boolean;
|
||||
// 适配老版本事件api
|
||||
|
@ -39,7 +42,11 @@ export class WrappedEvent {
|
|||
}
|
||||
}
|
||||
// stopPropagation和preventDefault 必须通过Event实例调用
|
||||
this.stopPropagation = () => nativeEvent.stopPropagation();
|
||||
this.stopPropagation = () => {
|
||||
nativeEvent.stopPropagation();
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
|
||||
this.preventDefault = () => nativeEvent.preventDefault();
|
||||
|
||||
// custom事件自定义属性
|
||||
|
@ -58,10 +65,6 @@ export class WrappedEvent {
|
|||
isDefaultPrevented(): boolean {
|
||||
return this.nativeEvent.defaultPrevented;
|
||||
}
|
||||
|
||||
isPropagationStopped(): boolean {
|
||||
return this.nativeEvent.cancelBubble;
|
||||
}
|
||||
}
|
||||
|
||||
// 创建普通自定义事件对象实例,和原生事件对应
|
||||
|
|
Loading…
Reference in New Issue