1.0.6 • Published 2 years ago

@nocyoung/vue-draggable v1.0.6

Weekly downloads
1
License
MIT
Repository
-
Last release
2 years ago

vue-draggable

Vue Drag and Drop component which can be used for PC and H5 without any dependency. Native HTML5 drag and drop implementation made for Vue.

Install

yarn add @nocyoung/vue-draggable

Usage

import Draggable from '@nocyoung/vue-draggable';
<Draggable
    :bounds="bounds"
    :defaultPosition="defaultPosition"
    @onUserDragStart="onUserDragStart"
    @onUserDragEnd="onUserDragEnd"
>
    <img
    :src="imgSrc"
    alt="你的图片"
    />
</Draggable>

bounds: 拖拽的边界, 为上下左右到左上角的距离, 单位为px, 比如:
bounds = { left: 100; right: 100; top:0, bottom:50 }

defaultPosition: 拖拽元素初始位置, 单位为px, 比如:
defaultPosition = { x: 100, y: 200, }

onUserDragStart: 拖拽开始回调,参数为位置坐标
onUserDragEnd: 拖放结束回调,参数为位置坐标

1.0.6

2 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago