use-mouse-event
v1.0.0
Published
#### Installtion
Maintainers
Readme
快速为元素绑定摁下/移动/抬起事件, 兼容手机端 touch 绑定
Installtion
npm i use-mouse-eventUsage
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 |
