Skip to content

Instantly share code, notes, and snippets.

@rdpascua
Forked from krzystof/v-sortable_es6.js
Created February 16, 2016 02:45
Show Gist options
  • Save rdpascua/360a1078f5a78d1629cc to your computer and use it in GitHub Desktop.
Save rdpascua/360a1078f5a78d1629cc to your computer and use it in GitHub Desktop.
import Sortable from 'sortablejs';
export default {
bind() {
var self = this;
Sortable.create(this.el, {
animation: 150,
dataIdAttr: 'data-id',
onUpdate () {
self.update(this.toArray());
}
});
},
update (val) {
return this.vm.$emit('orderChanged', val);
},
unbind() {
Sortable.destroy(this.el);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment