Created
January 15, 2017 20:50
-
-
Save c01nd01r/853ed80b1d54ac3902cd4f4c3fc2cb72 to your computer and use it in GitHub Desktop.
vue draggable
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
<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