Created
January 17, 2016 14:50
-
-
Save devcem/3f6be212e123c5f181c1 to your computer and use it in GitHub Desktop.
Vue sortable component
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
//Javascript | |
Vue.component('sort', { | |
template: "#sort-template", | |
props : ['data', 'id'], | |
ready: function (value) { | |
Sortable.create(document.getElementById(this.id), { | |
draggable: 'li' | |
}); | |
} | |
}); | |
//HTML | |
<sort :data="list" id="listElement"></sort> | |
//HTML | |
<script type="text/x-template" id="sort-template"> | |
<ul :id="id"> | |
<li v-for="item in data">{{item}}</li> | |
</ul> | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment