vue-sortable
vue-sortable copied to clipboard
How to get the container when drag into another container?
example:
<template>
<div>
<div v-for="c in categories">
<p>{{c.name}}</p>
<ul v-sortable="{group:'list',onEnd:onEnd}">
<li v-for="item in c.list">{{item}}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
data () {
return {
categories: [{
_id: '0000000001',
name: 'in progress',
list: ['111', '222']
}, {
_id: '0000000002',
name: 'plan',
list: ['333']
}, {
_id: '0000000003',
name: 'completed',
list: []
}]
}
},
methods: {
onEnd (e) {
console.log(e)
console.log(e.from === e.to) // why? Both of they refer to `from element`
}
}
}
</script>
Or JS Bin
Why e.from
will be equal to e.to
?
And is there any way to get both element the item drag from and to, how to get the category too.
That would make sense. But you can use the 'onAdd' event to achieve that.
That would make sense. But you can use the 'onAdd' event to achieve that.
good