1- # Vue.Dragable.For
1+ # Vue.Draggable
22
33
44[ ![ GitHub open issues] ( https://img.shields.io/github/issues/David-Desmaisons/Vue.Dragable.For.svg?maxAge=2592000 )] ( )
99[ ![ MIT License] ( https://img.shields.io/github/license/David-Desmaisons/Vue.Dragable.For.svg )] ( https://github.com/David-Desmaisons/Vue.Dragable.For/blob/master/LICENSE )
1010
1111
12- Vue directive for lists allowing drag-and-drop sorting in sync with View-Model. Based on [ Sortable.js ] ( https://github.com/RubaXa/Sortable )
12+ Vue component (Vue2.0) or directive (Vue1.0) allowing drag-and-drop and synchronization with view model array.
1313
14-
15- ##Motivation
16-
17- Create a directive that displays a dragable list and keeps in sync the view and underlying view model.
14+ Based on and offering all features of [ Sortable.js] ( https://github.com/RubaXa/Sortable )
1815
1916##Demo
2017
2118![ demo gif] ( https://raw.githubusercontent.com/David-Desmaisons/Vue.Dragable.For/master/example.gif )
2219
23- Simple:
2420
25- https://jsfiddle.net/dede89/j62g58z7/
21+ ##Features
2622
27- Two Lists:
23+ * Full support of [ Sortable.js] ( https://github.com/RubaXa/Sortable ) features
24+ * Keeps in sync view model and view
25+ * No jquery dependency
2826
29- https://jsfiddle.net/dede89/hqxranrd/
27+ ##For Vue.js 2.0
3028
31- Example with list clone :
29+ Use draggable component :
3230
33- https://jsfiddle.net/dede89/u5ecgtsj/
31+ ``` html
32+ <draggable :list =" list" :option =" {group:'people'}" @start =" dragging=true" @end =" dragging=false" >
33+ <div v-for =" element in list" >{{element.name}}</div >
34+ </draggable >
35+ ```
3436
35- ##Features
37+ ### Props
38+ #### list
39+ Type: ` Array ` <br >
40+ Required: ` false `
41+ Default: ` null `
3642
37- * Full support of [ Sortable.js] ( https://github.com/RubaXa/Sortable ) options via options parameters
38- * Keeps in sync view model and view
39- * No jquery dependency
43+ Array to be synchronized with drag-and-drop. Typically same array as refrenced by inner element v-for directive.
44+
45+ Note that draggabe component can be used with a list prop
46+
47+ #### option
48+ Type: ` Object ` <br >
49+ Required: ` true `
50+
51+ Option used to inicialize the sortable object see: [ sortable option documentation] ( https://github.com/RubaXa/Sortable#options )
52+
53+ Note that all the method starting by "on" will be ignored as draggable component expose the same API via events.
54+
55+ #### Events
56+ ` start ` , ` add ` , ` remove ` , ` update ` , ` end ` , ` choose ` , ` sort ` , ` filter ` , ` move ` , ` clone `
57+
58+ Called when there equivalent onStart, onAdd, .... are fired by Sortabe.js with the same argument.
59+
60+ [ See here for reference] ( https://github.com/RubaXa/Sortable#event-object-demo )
61+
62+
63+ ##For Vue.js 1.0
4064
4165##Usage
4266
@@ -59,28 +83,41 @@ Option parameter can be json string or a full javascript object.
5983 console .log (' Collection updated!' );
6084 },
6185` ` `
86+ ##Vue.js 1.0 fiddle
87+
88+ Simple:
89+
90+ https://jsfiddle.net/dede89/j62g58z7/
91+
92+ Two Lists:
93+
94+ https://jsfiddle.net/dede89/hqxranrd/
95+
96+ Example with list clone:
97+
98+ https://jsfiddle.net/dede89/u5ecgtsj/
6299
63100## Installation
64101- Available through:
65102` ` ` js
66- npm install vuedragablefor
103+ npm install vuedragabble
67104` ` `
68105` ` ` js
69- Bower install vue .dragable . for
106+ Bower install vue .draggable
70107` ` `
71108- #### For Modules
72109
73110 ` ` ` js
74111 // ES6
75112 import Vue from ' vue'
76- import VueDragableFor from ' vuedragablefor '
77- Vue .use (VueDragableFor )
113+ import VueDraggable from ' vuedraggable '
114+ Vue .use (VueDraggable )
78115
79116 // ES5
80117 var Vue = require (' vue' )
81- Vue .use (require (' vuedragablefor ' ))
118+ Vue .use (require (' vuedraggable ' ))
82119 ` ` `
83120
84121- #### For ` < script> ` Include
85122
86- Just include ` vue .dragable .for . js ` after Vue and lodash(version >=3).
123+ Just include ` vuedraggable . min . js ` or ' vue.dragable.for' after Vue. lodash(version >=3) is needed only for Vuejs. 1.0 version of the library .
0 commit comments