1.0.0 • Published 1 year ago
use-mouse-event v1.0.0
快速为元素绑定摁下/移动/抬起事件, 兼容手机端 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 |
1.0.0
1 year ago