0👍
you can do like this.
var local = {
template: '#template-drag',
name: 'local-draggable',
props: ['tasks']
};
new Vue({
el: "#app",
components: {
"local-draggable" : local
},
data: {
"tasks": [
{
"name": "task 1",
"tasks": []
},
{
"name": "task 2",
"tasks": []
},{
"name": "task 3",
"tasks": []
},
{
"name": "task 4",
"tasks": []
},
{
"name": "task 5",
"tasks": []
},
{
"name": "task 6",
"tasks": [
{
"name": "task 6.1",
"tasks": []
}
]
}
]
},
});
.parent{
position: relative;
padding-left: 15px;
}
.dragArea {
border: 1px dashed;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.dragArea .dragArea > .parent {
position: relative;
padding-left: 30px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<script src="https://unpkg.com/sortablejs@1.7.0"></script>
<script src="https://unpkg.com/vuedraggable@2.16.0/dist/vuedraggable.js"></script>
<script type="text/x-template" id="template-drag">
<draggable :element="'div'" :list="tasks" class="dragArea" :options="{group:{ name:'g1'}}" >
<template v-for="el in tasks" class="parent">
<div class="parent">
<p>{{el.name}} - {{el.tasks}}</p>
<local-draggable :tasks="el.tasks"/>
</div>
</template>
</draggable>
</script>
<div id="app">
<local-draggable :tasks="tasks"/>
</div>
- [Vuejs]-How to use onchange event on selectize in vuejs?
- [Vuejs]-Event emitters parameter is undefined for listener Vue js
Source:stackexchange.com