Skip to content

Instantly share code, notes, and snippets.

@c01nd01r
Created January 15, 2017 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c01nd01r/853ed80b1d54ac3902cd4f4c3fc2cb72 to your computer and use it in GitHub Desktop.
Save c01nd01r/853ed80b1d54ac3902cd4f4c3fc2cb72 to your computer and use it in GitHub Desktop.
vue draggable
<template>
<div class="hello">
<draggable :list="list" :options="{animation: 150}" >
<div v-for="element in list" class="element">{{element.name}}</div>
</draggable>
</div>
</template>
<script>
import draggable from 'vuedraggable';
export default {
name: 'hello',
data() {
return {
list: [
{ name: 'Line 0' },
{ name: 'Line 1' },
{ name: 'Line 2' },
{ name: 'Line 3' },
{ name: 'Line 4' },
],
};
},
components: {
draggable,
},
};
</script>
<style type="text/css">
.element {
box-shadow: 1px 1px 1px 0px #e2e2e2;
width: 300px;
margin: 0 auto;
border: 1px solid #ccc;
margin-bottom: 5px;
padding: 10px;
cursor: move;
background: #35495e;
color: #fff;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment