vue-sortable icon indicating copy to clipboard operation
vue-sortable copied to clipboard

How to get the container when drag into another container?

Open varHarrie opened this issue 8 years ago • 2 comments

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.

varHarrie avatar Aug 23 '16 10:08 varHarrie

That would make sense. But you can use the 'onAdd' event to achieve that.

robverhoef avatar Sep 09 '16 11:09 robverhoef

That would make sense. But you can use the 'onAdd' event to achieve that.

good

isaacqian avatar Jun 13 '23 09:06 isaacqian