1.0.0 • Published 1 year ago

use-mouse-event v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

快速为元素绑定摁下/移动/抬起事件, 兼容手机端 touch 绑定

Installtion

npm i use-mouse-event

Usage

import useMouseEvent from "use-mouse-event";

const stop = useMouseEvent({
  el: "body",
  onStart: (e) => {},
  onMove: (e) => {},
  onEnd: (e) => {},
});

// 解绑事件
stop();

Props

参数名说明类型
el绑定元素(必填)string,HTMLELEMENT
onStart摁下回调function
onMove移动回调function
onEnd抬起/结束回调function