Open timothymarois opened 2 years ago
It looks like it only does that when you try to use tag="transition-group"
which is what this example said to do:
https://github.com/SortableJS/vue.draggable.next/blob/master/example/components/transition-example.vue
I'm not sure why this error occurs, but the current work around fix I'm personally using is as follows:
tag
property from component-data
and just have type: 'transition-group'
ul
You don't need to have transition
& transition-group
elements, just one parent transition-group
element will do the job in most cases.
Hi @xbanki I'm facing the same issue and not clearly understand your answer. Could you please put an example of your comment ? Thank you very much for your time.
right answers:
`
</template>
</draggable>`
tips: Do not set tag=transtion-group, You should set component-data={type: 'transtion-group'} will be right。
Tried out your suggestion but still not working in my case. Thanks for your help :
<draggable
v-model="teams"
:component-data="{
name: 'fade',
type: 'transition-group',
}"
item-key="idteam"
class="grid sm:grid-cols-3 xl:grid-cols-4 grid-cols-2 gap-6"
>
<template #item="{ element, index }">
<my-team
:key="element.idteam"
:id="element.idteam"
:name="element.teamName"
:index="index"
@getTeams="getTeams"
></my-team>
</template>
</draggable>
Tried out your suggestion but still not working in my case. Thanks for your help :
<draggable v-model="teams" :component-data="{ name: 'fade', type: 'transition-group', }" item-key="idteam" class="grid sm:grid-cols-3 xl:grid-cols-4 grid-cols-2 gap-6" > <template #item="{ element, index }"> <my-team :key="element.idteam" :id="element.idteam" :name="element.teamName" :index="index" @getTeams="getTeams" ></my-team> </template> </draggable>
Yes, i tried that too and didnt work on me too. I using nuxt 3 btw. It only happening when add tag="transition-group"
.
right answers:
<draggable v-model="myArray" :component-data="{name:'fade', type: 'transtion-group'}" item-key="id"> <template #item="{element}"> <div class="item" :class="{disabled: !!element.disabled}">{{element.name}}</div> </template> </draggable>
tips: Do not set tag=transtion-group, You should set component-data={type: 'transtion-group'} will be right。
it works.Thanks a lot!
same problem on my demo.
TypeError: Cannot set properties of null (setting '__draggable_context')
this error only happen on tag="TransitionGroup"
or tag="transition-group"
For those who still run into this issue, see issue #180 that was opened above for a working example that is in-line with my previous suggestion.
https://github.com/SortableJS/vue.draggable.next/pull/145 fixed this but not to be merged 😮💨
As a temporary solution:
yarn add zhyswan-vuedraggable@4.1.3
import draggable from 'zhyswan-vuedraggable'
Adding
item-key="id"
doesnt work, it throws this error:When you omit the item key it throws a warning that you need to include the item key prop. So its a catch-22. The items in my case have
id
property, but using that here, like in the examples on this repo, it doesn't work.As an example to what I'm using: