【文件属性】:
文件名称:react-stretch
文件大小:277KB
文件格式:ZIP
更新时间:2021-05-28 01:25:26
JavaScript
#基于react的dom拖拽拉伸
npm install react-stretch
-- 包含两个组件 --
---1. useStretch: hook
使用方法:
import { useStretch } from 'react-stretch';
const distance = useStretch(ref);
interface Distance {
x: number; // 拖拽的x轴距离
y: number; // 拖拽的y轴距离
pageX: number; // 拖拽后的x轴位置
pageY: number; // 拖拽后的y轴位置
}
---2. react-stretch组件,基于useStretch实现
使用方法:
import ReactStretch from 'react-stretch';
<ReactStretch
【文件预览】:
react-stretch-master
----.gitignore(259B)
----.babelrc(383B)
----package.json(1KB)
----webpack()
--------prod.config.js(2KB)
--------dev.config.js(2KB)
----package-lock.json(367KB)
----src()
--------main.js(195B)
--------app.tsx(211B)
--------Stretch()
--------tab()
--------upload()
--------hooks()
----webpack.config.js(200B)
----public()
--------images()
--------index.html(965B)
----tsconfig.json(6KB)
----utils()
--------index.ts(94B)
--------dom.ts(692B)
----README.md(1KB)
----typing()
--------index.d.ts(33B)