Search code examples
vue.jssortablejsvuedraggablevue-transitions

How to use vuedraggable with transition groip and header slot together


I have working code with transtition group making flip animation

<draggable
    v-model="items"
    group="backlog-posts"
    animation="200"
    handle=".post-content"
    draggable=".drag-item"
    @start="drag = true"
    @end="drag = false"
>
    <transition-group
        type="transition"
        tag="div"
        :name="!drag ? 'flip-list' : null"
    >
        <ArticlePost
            v-for="post in items"
            :key="post.id"
            class="drag-item"
            :post="post"        
        />
    </transition-group>
</draggable>

This is very similar to example snippet from vuedraggable documentation. When I add header slot, it stops working

<div slot="header">Hello!</button>

If remove transition group and keeps only header it works again (header is displayed and obviously now animation is there)

How to get header + animated drag&drop?


Solution

  • From https://github.com/SortableJS/Vue.Draggable:

    Slots

    Limitation: neither header or footer slot works in conjunction with transition-group.