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

transition does not work #228

Open murilolivorato opened 1 year ago

murilolivorato commented 1 year ago

Hello , I am using vue Draggable with VUE 3 . but transition is not workig .

I did many ways , I did like this -

  <Draggable
                                              v-model="data"
                                              class="space-y-3"
                                              drag-class="drag"
                                              ghost-class="ghost"
                                              group="listproperties"
                                              item-key="index"
                                              tag="ul"
                                              handle=".handle"
                                              @start="drag = true"
                                              @end="drag = false"
                                            >

                                              <template #item="{element}">
                                                <TransitionGroup type="transition" :name="!drag ? 'flip-list' : null" tag="div">
                                                  <my-component
                                                                         :property="element"
                                                                         :index="data.indexOf(element)"
                                                                         :key="data.indexOf(element)" >
                                                </TransitionGroup>
                                              </template>
                                            </Draggable>

CSS -

.flip-list-move {
  transition: transform 0.5s;
}

.no-move {
  transition: transform 0s;
}

.ghost {
  opacity: 0.5;
  background: #c8ebfb;
}

.list-group {
  min-height: 20px;
}

.list-group-item {
  cursor: move;
}

.list-group-item i {
  cursor: pointer;
}
WailanTirajoh commented 1 year ago

Yap, tried with the example provided, got error on console.

alecgibson commented 1 year ago

We're also getting a console error:

logger.ts:114 TypeError: Cannot set properties of null (setting '__draggable_context')
    at addContext (vuedraggable.umd.js:4478:1)
    at eval (vuedraggable.umd.js:4523:1)
    at Array.forEach (<anonymous>)
    at ComponentStructure.updated (vuedraggable.umd.js:4522:1)
    at Proxy.mounted (vuedraggable.umd.js:4808:1)
    at eval (vue.esm-bundler.js:4690:1)
    at callWithErrorHandling (vue.esm-bundler.js:1640:1)
    at callWithAsyncErrorHandling (vue.esm-bundler.js:1648:1)
    at hook.__weh.hook.__weh (vue.esm-bundler.js:4670:1)
    at flushPostFlushCbs (vue.esm-bundler.js:1807:1)
thibaultvanc commented 10 months ago

same error here on vue3

MiladRST commented 10 months ago

Using transition causes a console error !

Kamsou commented 9 months ago

Hey guys ! is there a fix?

jTiKey commented 8 months ago

The only available transition is

const dragOptions = {
  animation: 200,
}

draggable(v-bind="dragOptions"

Filip1139 commented 7 months ago

same problem here

fuxianwei commented 6 months ago

+1

ronannnn commented 6 months ago

+1

hahatulk commented 5 months ago

+1

john-psina commented 3 months ago

+1

vukadinFE commented 2 months ago
vukadinFE commented 2 months ago

The only available transition is

const dragOptions = {
  animation: 200,
}

draggable(v-bind="dragOptions"

For anyone who is searching for the answer, if you put only :animation="200" or what ever duration you need, without setting the tag to transition-group or adding extra <TransitionGroup> it will just work.