|
1 | 1 | (function(){
|
2 |
| - function buildVueDragFor(_){ |
| 2 | + function buildVueDragFor(_, Sortable){ |
3 | 3 |
|
4 | 4 | function mix(source, functions){
|
5 | 5 | _.forEach(['bind', 'update', 'unbind'],function(value){
|
|
40 | 40 | });
|
41 | 41 | var parent = (!!this.params.root) ? document.getElementById(this.params.root) : this.el.parentElement;
|
42 | 42 | parent.__directive = this;
|
43 |
| - this.sortable = new Sortable(parent, options); |
| 43 | + this._sortable = new Sortable(parent, options); |
44 | 44 | },
|
45 | 45 | update : function (value){
|
46 | 46 | if ((!!value) && (!Array.isArray(value)))
|
|
49 | 49 | this.collection = value;
|
50 | 50 | },
|
51 | 51 | unbind : function (){
|
52 |
| - this.sortable.destroy(); |
| 52 | + this._sortable.destroy(); |
53 | 53 | }
|
54 | 54 | });
|
55 | 55 |
|
|
61 | 61 |
|
62 | 62 | if (typeof exports == "object") {
|
63 | 63 | var _ = require("lodash.js");
|
64 |
| - module.exports = buildVueDragFor(_); |
| 64 | + var Sortable = require("Sortable.js"); |
| 65 | + module.exports = buildVueDragFor(_, Sortable); |
65 | 66 | } else if (typeof define == "function" && define.amd) {
|
66 |
| - define(['lodash'], function(_){ return buildVueDragFor(_); }); |
67 |
| - } else if ((window.Vue) && (window._)) { |
68 |
| - window.vueDragFor = buildVueDragFor(window._); |
| 67 | + define(['lodash', 'Sortable'], function(_, Sortable){ return buildVueDragFor(_, Sortable; }); |
| 68 | + } else if ((window.Vue) && (window._) && (window.Sortable)) { |
| 69 | + window.vueDragFor = buildVueDragFor(window._, window.Sortable); |
69 | 70 | Vue.use(window.vueDragFor);
|
70 | 71 | }
|
71 | 72 | })();
|
0 commit comments