Skip to content

Instantly share code, notes, and snippets.

@krzystof
Last active December 3, 2015 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krzystof/08e0c40e1e2f47cb4910 to your computer and use it in GitHub Desktop.
Save krzystof/08e0c40e1e2f47cb4910 to your computer and use it in GitHub Desktop.
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _sortablejs = require('sortablejs');
var _sortablejs2 = _interopRequireDefault(_sortablejs);
exports['default'] = {
params: ['options', 'eventName'],
bind: function bind() {
var self = this;
this.params.options.onUpdate = function () {
self.update(this.toArray());
}, this.sortable = _sortablejs2['default'].create(this.el, this.params.options);
},
update: function update(val) {
if (typeof val === 'undefined') {
return;
}
this.vm.$emit(this.params.eventName, val);
},
unbind: function unbind() {
this.sortable.destroy();
}
};
module.exports = exports['default'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment