vue-dnd2
v1.0.1
Published
A clone Vue Drag n' Drop now supported by 2.0 version of VueJS
Downloads
5
Maintainers
Readme
VUE-DND2
A clone Vue Drag n' Drop now supported by VueJS v2
The whole concept of this plugin was made based on the already existing Lain-dono - Now supported by v2 of VueJS
Install
npm install vue-dnd2 --save
Usage
Vue.use(require('vue-dnd2'))
Add the drag n' drop directive to the elements that will accept this usability. You can decide which elements will be able to be draggable or droppable or both.
Draggable sintax
<div v-draggable.cart="{product_id: item.id, price: item.price}"></div>
| Param | Value | |------------|-----------| | cart | The Group. You can choose a group of elements that will interact with drag n 'drop | | product_id | The Key object. A key object that will be passed to droppable element | | item.id | The Value. |
Droppable sintax
<div v-droppable.cart="foo"></div>
...
methods: {
foo: function ($ev) {
// $ev contains the draggable object
}
}
| Param | Value | |------------|-----------| | cart | The Group. You can choose a group of elements that will interact with drag n 'drop | | foo | The Function. The function that will be called when the same group element is dropped in the droppable container |