Skip to content

Instantly share code, notes, and snippets.

@savepong
Created December 14, 2020 09:29
Show Gist options
  • Save savepong/a4d44826b22b5f55ead22525b27de7b7 to your computer and use it in GitHub Desktop.
Save savepong/a4d44826b22b5f55ead22525b27de7b7 to your computer and use it in GitHub Desktop.
Sample Multi Drag Code
<div id="app">
<v-app id="inspire">
<v-card
class="mx-auto"
tile
>
<draggable v-for="(item, index) in images"
v-model="images[index]"
group="image"
animation="150"
selected-class="sortableSelected"
ghost-class="imageGhost"
@change="imagesChanged"
tag="v-layout"
class="sortableRow imageContainer"
:component-data="{row: true}"
:force-fallback="true"
multi-drag>
<v-flex v-for="image in item" class="droppableImage" :key="image.path">
{{image}}
</v-flex>
</draggable>
</v-card>
</v-app>
</div>
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: () => ({
images: [[
'Real-Time',
'Audience',
'Conversions',
],[
'Real-Time2',
'Audience2',
'Conversions2',
]]
}),
methods: {
imagesChanged(e) {
console.log(e)
}
}
})
<script src="https://cdn.jsdelivr.net/npm/babel-polyfill/dist/polyfill.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.1.9/dist/vuetify.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Flip535/Vue.Draggable@be82d2a15f99fc80c0fc836aa8550ff07d943a60/dist/vuedraggable.umd.js"></script>
.sortableSelected {
background-color: yellow;
}
.imageContainer {
border: solid 10px black;
padding: 4px;
}
.droppableImage {
border: solid 1px black;
margin: 5px;
}
.imageGhost {
background-color: lightblue
}
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.1.9/dist/vuetify.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment