May 10, 2019
Drag-and-Drop Sortable with vuejs and vuejs-ui-sortable-vuejs Modules
Drag-and-Drop Sortable with vuejs and vuejs-ui-sortable-vuejs Modules
Easily add simple Example of drag-and-drop (Vue.js Sortable)sorting to your web Vue.js applications without any load jQuery, using the main v-sortable directive, a thin bootsrep wrapper for same the minimalist new SortableJS libs.
Simple Vue component allowing To the drag-and-drop example sorting in sync with View-Model example. Based on vuejs Sortable.jsDrag-and-Drop Sortable with vuejs and vuejs-ui-sortable-vuejs Modules
Features of Vue.js Sortable
- Supports sample touch devices in vuejs
- Supports drag (drag-and-drop ) handles and selectable text
- Smart all of the auto-scrolling
- Support drag and drop two fields between different lists
- No any jQuery (required) dependency
Include Vuejs and Other Libs
<a href="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.12/vue.min.js">https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.12/vue.min.js</a> <a href="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.2/Sortable.min.js">https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.2/Sortable.min.js</a> <a href="http://js/index.js">http://js/index.js</a>
index.html
<title>Sortable - vuejs Modules, Plugins and Directives |Sortable with vue.js</title> <h1>Sortable - vuejs Modules, Plugins and Directives Example</h1> <div class="ui cards" id="list"> <div class="card"> <div class="content"> <div class="header">{{ person.name }}</div> <div class="description">{{ person.description }}</div> </div> <div class="ui bottom attached button"> <i class="add icon"></i> <a href="https://infinityknow.com/" title="angularjs and vuejs">Add Content</a> </div> </div> </div>
index.js
Vue.directive( "sortable", function( value ) { var that = this, key = this.arg; value = value || {}; value.onUpdate = function( e ) { var vm = that.vm, array = vm[ key ], target = array[ e.oldIndex ]; array.$remove( target ); array.splice( e.newIndex, 0, target ); vm.$emit( "sort", target, e.oldIndex, e.newIndex ); }; Sortable.create( this.el, value ); }); new Vue({ el: "#list", data: { persons: [ { name: "infinityknow.com", description: "We are Web Technology Experts and Team who provide you very Important information on Web Development information." }, { name: "infinityknow.com/tutorial", description: "Interview Questions and Answers, live project problem solution and their solution and online free tutorials – “infinityknow.com”." }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" },{ name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" }, { name: "infinityknow.com/status", description: "infinityknow.com is a Project Free Download at the New School" } ] }, events: { sort: function( item, oldIndex, newIndex ) { console.log( item ); } } });