Last active
April 9, 2016 23:43
-
-
Save krzystof/9ca9aa54fe4303ca187c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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