interface Event {
   
readonly bubbles: boolean;
   
readonly cancelable: boolean;
   
cancelBubble: boolean;
   
readonly currentTarget: EventTarget;
   
readonly defaultPrevented: boolean;
   
readonly eventPhase: number;
   
readonly isTrusted: boolean;
   
returnValue: boolean;
   
readonly srcElement: Element | null;
   
readonly target: EventTarget;
   
readonly timeStamp: number;
   
readonly type: string;
   
readonly scoped: boolean;
   
initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;
   
preventDefault(): void;
   
stopImmediatePropagation(): void; //和stopProgagation有什么区别?
   
stopPropagation(): void;
   
deepPath(): EventTarget[];
   
readonly AT_TARGET: number;
   
readonly BUBBLING_PHASE: number;
   
readonly CAPTURING_PHASE: number;
}

declare var Event: {
   
prototype: Event;
   
new(typeArg: string, eventInitDict?: EventInit): Event;
   
readonly AT_TARGET: number;
   
readonly BUBBLING_PHASE: number;
   
readonly CAPTURING_PHASE: number;
};


1. 常见的事件
表单事件:
  • change

鼠标事件:

键盘事件:

触控板滚动事件、鼠标中键滚动:
  • 都是 监控scroll???
2. mouseEvent
  • 坐标位置
  • button鼠标哪个键被按下
    • 0:鼠标左键被按下
    • 1:滚轮(中键)被按下
    • 2:右键被按下


target是element


  • 事件发生时的操作
         
  • key/code:对应的按键

1. 事件

2019-02-17 00:10:19 0 13
这里是评论

相关推荐