Draggable vue based Sortable.js the assembly, to achieve drag and drop.
characteristic
Support for touch devices
support drag and select the text
with smart scrolling
supports drag and drop between the different lists
not to jQuery-based
and synchronized view model refresh
and vue2 kingdom animated compatible
support for undo operations
when needed full control, you can throw all changes
It can be compatible with existing UI components
installation
npm install vuedraggable
Introduced
import draggable from 'vuedraggable'
Official Examples:
hello.vue
<template>
<div class="fluid container"> <div class="form-group form-group-lg panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Sortable control</h3> </div> <div class="panel-body"> <div class="checkbox"> <label><input type="checkbox" v-model="editable">Enable drag and drop</label> </div> <button type="button" class="btn btn-default" @click="orderList">Sort by original order</button> </div> </div> <div class="col-md-3"> <draggable class="list-group" element="ul" v-model="list" :options="dragOptions" :move="onMove" @start="isDragging=true" @end="isDragging=false"> <transition-group type="transition" :name="'flip-list'"> <li class="list-group-item" v-for="element in list" :key="element.order"> <i :class="element.fixed? 'fa fa-anchor' : 'glyphicon glyphicon-pushpin'" @click=" element.fixed=! element.fixed" aria-hidden="true"></i> {{element.name}} <span class="badge">{{element.order}}</span> </li>