Alfred-Skyblue / vue-draggable-plus

Universal Drag-and-Drop Component Supporting both Vue 3 and Vue 2
https://vue-draggable-plus.pages.dev/en/
MIT License
2.72k stars 106 forks source link

当direction="horizontal"时 , 子元素拖动至指定区域外,拖动的子元素位置改变生效,子元素dragend事件失效 #87

Closed SanpLee closed 6 months ago

SanpLee commented 6 months ago

当direction="horizontal"时 , 子元素拖动至指定区域外,拖动的子元素位置改变生效,子元素dragend事件失效,

我的子元素数据在 dragend事件中获取,dragend事件失效我无法知道是哪个子元素数据改变了

代码如下:

<VueDraggable
                class="flex flex-col gap-2 w-full p-2"
                :class="{ 'h-full border border-dashed border-slate-300': isDragLane(item) }"
                v-model="dragList[index].notStarted"
                :animation="150"
                :group="`lane${dyItemId(item)}`"
                :sort="false"
                :swapThreshold="0.5"
                direction="horizontal"
                @choose="onChoose"
                @unchoose="onUnchoose"
                @start="onStart($event, { id: dyItemId(item), state: '1' })"
                @move="onMove"
                @update="onUpdate"
                @add="onAdd"
                @remove="remove"
                @end="onEnd($event, '1')"
                @change="onChange($event, '1')"
                v-show="isExpandRow(item)"
              >
                <ItemCard
                  v-for="childItem in item.notStarted"
                  :key="childItem.id"
                  :data="childItem"
                  state="1"
                  v-model="mainExSwitchState"
                  @dragend="handleDrag(childItem)"
                />
              </VueDraggable>
11
SanpLee commented 6 months ago

已解决

Alfred-Skyblue commented 6 months ago

@SanpLee 您可以分享一下解决方案吗?以便更多人参考,谢谢。

SanpLee commented 6 months ago

@SanpLee 您可以分享一下解决方案吗?以便更多人参考,谢谢。

我写的逻辑有问题,后来找到问题了, 和vue-draggable-plus没关系

Alfred-Skyblue commented 6 months ago

ok