在React和Vanilla JavaScript中用于组件串接鼠标/触摸手势的面包n黄油工具.
@ use- gesture( 用户名) [(ZZURL0ZH).
@ use- gesture 是允许您将更丰富的鼠标绑定并触摸事件到任何组件或视图的库. 有了你收到的数据,设置手势就变得微不足道了,而且往往只需要几行代码.
你可以单独使用它,但为了充分利用它,你应该把它和像React-Spring这样的动画库结合起来,尽管你当然可以使用其他的.
<p对齐="中间"] <a href='https://codesandbox.io/s/github/pmndrs/use-gesture/tree/main/demo/src/sandboxes/draggable-list"> <a href='https://codesandbox.io/s/github/pmndrs/use-gesture/tree/main/demo/src/sandboxes/cards-stack"> <a href=' https://codesandbox.io/s/github/pmndrs/use-gesture/tree/main/demo/src/sandboxes/action-sheet"> <a href=' https://codesandbox.io/s/github/pmndrs/use-gesture/tree/main/demo/src/sandboxes/infinite-slideshow"> <a href='https://codesandbox.io/s/github/pmndrs/use-gesture/tree/main/demo/src/sandboxes/viewpager"> <a href='https://codesandbox.io/s/github/pmndrs/use-gesture/tree/main/demo/src/sandboxes/card-zoom">
(中文(简体) ).演示会是真实的点击!
□ 安装
###(React)
(原始内容存档于2019-09-29) (英语). ```bash #Yarn yarn add @use-gesture/react
#NPM npm install @use-gesture/react
香草JavaScript
ZZ1ZZ
[完整文档网站] (ZZURL8Z).
- [活手] (ZZURL9Z)
- [地 (ZZURL10Z)
- [设备选择] (ZZURL11Z)
- [法 [ZZURL12Z]
简单的例子
<p对齐="中间"]
<a href='https://codesandbox.io/s/github/pmndrs/use-gesture/tree/main/demo/src/sandboxes/gesture-simplest"></a>
</p> (中文(简体) ).
< 细节>
<摘要>React </摘要>
{\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢?
从“ @ React- spring/ web” 导入 {使用春天, 动画}
从“ @use-gesture/React” 导入{使用Drag}
函数示例(){
const [{ x, y }, api] = 使用Spring ( ( () ) ({ x: 0, y: 0 })
// 设置拖勾并定义组件 m维护: 提供审查、CI 和发布方面的帮助
`transform` 属性会破坏缩放和滚轮操作
[错误] `pointerDown` 中的 `setPointerCapture` 应包裹在 try-catch 中
[Docs-Bug] - 主网站在初始加载时出现故障
点击虫: 在打开/关闭上下文菜单后,可以使用 1 个手指触发点击手势
usePinch 不能与 react-spring v10 一起使用
在 iOS 中,在 preventScroll 为 true 时,点击后不会重新计算
在 useDrag 中结合 filterTaps 和 preventScroll 选项会破坏拖动容器内元素的 onclick 事件
使用 `preventScroll` 拖动: 如果在超时之前触发 pointerup,则会跳过此事件
Vanilla - 快速手势期间出现错误