Skip to content

Instantly share code, notes, and snippets.

@krzystof
Last active April 9, 2016 23:43
Show Gist options
  • Save krzystof/9ca9aa54fe4303ca187c to your computer and use it in GitHub Desktop.
Save krzystof/9ca9aa54fe4303ca187c 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