mfuu / vue-virtual-drag-list

A virtual scrolling list component that can be sorted by dragging
https://mfuu.github.io/vue-virtual-drag-list/
MIT License
32 stars 11 forks source link

Events doesn't correct if add draggable prop #36

Open bavrr opened 4 months ago

bavrr commented 4 months ago

I got something like

VirtualList.taxonomy-list__scroller(
         v-model="visibleTree"
          :data-key="'id'"
          draggable=".taxonomy-list__group"
          :fallback-on-body="true"
          :group="'taxonomy'"
          :keeps="50"
          :size="36"
          @drag="onDrag"
          @drop="onDrop"
        )
          template(#item="{record}")
            TaxonomyTaxonomy.taxonomy-list__group(
              v-if="record.parent_id === null && !record.special"
              :taxonomy="record"
            )
            TaxonomyTaxon(
              v-else-if="!record.special"
              :is-opened="expandedTaxonomyKeys.has(record.id)"
              :taxon="record"
            )
            TaxonomyWithout.taxonomy-list__group(
              v-else
              :taxon="record"
            )

With prop draggable=".taxonomy-list__group" i can drag correct items, but index is always -1, key = null, item = undefined (tested for onDrag and onDrop) image

DOM structure: image

If i remove this prop, all would be work correctly. image image

mfuu commented 4 months ago

@bavrr please update to the latest version to see if works correct

bavrr commented 4 months ago

@mfuu fixed, ty