@nutui/nutui-react
Version:
京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序
44 lines (43 loc) • 1.04 kB
TypeScript
import { default as React, FunctionComponent } from 'react';
import { BasicComponent } from '../../utils/typings';
export interface DragState {
offset: [x: number, y: number];
}
export interface DragProps extends BasicComponent {
/**
* 是否开启自动吸边
* @default false
*/
attract: boolean
/**
* 拖拽元素的拖拽方向限制
* @default all
*/
direction: 'x' | 'y' | 'lock' | undefined
/**
* 拖拽元素的拖拽边界
* @default {top: 0, left: 0, right: 0, bottom: 0}
*/
boundary: {
top: number;
left: number;
right: number;
bottom: number;
}
/**
* 开始拖拽元素
* @default -
*/
onDragStart: () => void
/**
* 停止拖拽元素
* @default -
*/
onDragEnd: (state: DragState) => void
/**
* 拖拽元素
* @default -
*/
onDrag: (state: DragState) => void
}
export declare const Drag: FunctionComponent<Partial<DragProps> & React.HTMLAttributes<HTMLDivElement>>;