SortableJS / vue.draggable.next

Vue 3 compatible drag-and-drop component based on Sortable.js
https://sortablejs.github.io/vue.draggable.next/#/simple
MIT License
3.91k stars 531 forks source link

How can i add Multi-Drag plugin to vue.draggable.next? #221

Open hrynevychroman opened 1 year ago

hrynevychroman commented 1 year ago

How can i implement multidrag plugin? https://github.com/SortableJS/Sortable/tree/master/plugins/MultiDrag I try to add something like this, but it don't work, also i see that it is calling on Sortable.mount(), how can i make it with VueDraggable? image

ilzbergs commented 1 year ago

Interested in this too!

acordy commented 7 months ago

Very interested in this feature as well.

duoluodexiaoxiaoyuan commented 5 months ago

How can i implement multidrag plugin? https://github.com/SortableJS/Sortable/tree/master/plugins/MultiDrag如何实现多拖插件?https://github.com/SortableJS/Sortable/tree/master/plugins/MultiDrag I try to add something like this, but it don't work, also i see that it is calling on Sortable.mount(), how can i make it with VueDraggable?我尝试添加这样的东西,但它不起作用,我也看到它正在调用 Sortable.mount(),我如何使用 VueDraggable 制作它? image

i want to ask this problem is sloved?

biroplane commented 2 months ago

anyone?

biroplane commented 2 months ago

Ok, finally got it. To make it work with Draggable vue 3 component i came up with this: (maybe not a super clean solution, but it works 😄 )

onMounted(() => {
  // get the element. ref won't work
  const clauseList = document.getElementById("clause_list")
  if (!clauseList)
    return
  Sortable.mount(new MultiDrag())
  sortable.value = Sortable.create(clauseList, {
    animation: 300,
    multiDrag: true, // Enable the plugin
    selectedClass: "selected", // Class name for selected item
    avoidImplicitDeselect: false, // true - if you don't want to deselect items on outside click

  })
})

in the template


<Draggable id="clause_list">
    ...all other stuff
</Draggable>```

hope this helps
duoluodexiaoxiaoyuan commented 2 months ago

Ok, finally got it. To make it work with Draggable vue 3 component i came up with this: (maybe not a super clean solution, but it works 😄 )

onMounted(() => {
  // get the element. ref won't work
  const clauseList = document.getElementById("clause_list")
  if (!clauseList)
    return
  Sortable.mount(new MultiDrag())
  sortable.value = Sortable.create(clauseList, {
    animation: 300,
    multiDrag: true, // Enable the plugin
    selectedClass: "selected", // Class name for selected item
    avoidImplicitDeselect: false, // true - if you don't want to deselect items on outside click

  })
})

in the template

<Draggable id="clause_list">
    ...all other stuff
</Draggable>```

hope this helps

thank you very much, It's a pity that this library is no longer maintained.