Skip to content

Commit

Permalink
Adjust dist files + update README.md with documentation of issue #316
Browse files Browse the repository at this point in the history
…and issue #268
  • Loading branch information
David-Desmaisons committed Dec 30, 2017
1 parent 9f1d976 commit baf412f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ Note that all the method starting by "on" will be ignored as draggable component
Type: `String`<br>
Default: `'div'`
HTML node type of the element that draggable component create as outer element for the included slot.
HTML node type of the element that draggable component create as outer element for the included slot.<br>
It is also possible to pass the name of vue component as element. In this case, draggable attribute will be passed to the create component.<br>
See also [componentData](#componentData) if you need to set props or event to the created component.
#### clone
Type: `Function`<br>
Expand Down Expand Up @@ -178,6 +180,45 @@ checkMove: function(evt){
```
See complete example: [Cancel.html](https://github.com/SortableJS/Vue.Draggable/blob/master/examples/Cancel.html), [cancel.js](https://github.com/SortableJS/Vue.Draggable/blob/master/examples/script/cancel.js)
#### componentData
Type: `Object`<br>
Required: `false`<br>
Default: `null`<br>
This props is used to pass additional information to child component declared by [element props](#element).<br>
Value:
* `props`: props to be passed to the child component
* `on`: events to be subscribe in the child component
Example (using [element UI library](http://element.eleme.io/#/en-US)):
```HTML
<draggable element="el-collapse" :list="list" :component-data="getComponentData()">
<el-collapse-item v-for="e in list" :title="e.title" :name="e.name" :key="e.name">
<div>{{e.description}}</div>
</el-collapse-item>
</draggable>
```
```javascript
methods: {
handleChange() {
console.log('changed');
},
inputChanged(value) {
this.activeNames = value;
},
getComponentData() {
return {
on: {
change: this.handleChange,
input: this.inputChanged
},
props: {
value: this.activeNames
}
};
}
}
```
### Events
Expand Down
4 changes: 1 addition & 3 deletions dist/vuedraggable.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
Expand Down Expand Up @@ -395,7 +393,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
return draggableComponent;
}

if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) == "object") {
if (typeof exports == "object") {
var Sortable = require("sortablejs");
module.exports = buildDraggable(Sortable);
} else if (typeof define == "function" && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion dist/vuedraggable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit baf412f

Please sign in to comment.