SortableJS / Vue.Draggable

Vue drag-and-drop component based on Sortable.js
https://sortablejs.github.io/Vue.Draggable/
MIT License
20.18k stars 2.9k forks source link

end event do not excute when container key set random!! #1138

Open wan766405890 opened 2 years ago

wan766405890 commented 2 years ago

valid code

<div v-for="(item, listIndex) in leftComponents" :key="listIndex">
    <div class="components-title">
      <!-- <svg-icon icon-class="component" /> -->
      {{ item.title }}
    </div>
    <draggable class="components-draggable" :list="item.list" :group="{ name: 'componentsGroup', pull: 'clone', put: false }" :clone="cloneComponent" draggable=".components-item" :sort="false" @end="onEnd">
      <div v-for="(element, index) in item.list" :key="index" class="components-item" @click="addComponent(element)">
        <div class="components-body">
          <svg-icon :icon-class="element.__config__.tagIcon" />
          {{ element.__config__.label }}
        </div>
      </div>
    </draggable>
  </div>

invalid code

<div v-for="(item, listIndex) in leftComponents" :key="Math.random()">
    <div class="components-title">
      <!-- <svg-icon icon-class="component" /> -->
      {{ item.title }}
    </div>
    <draggable class="components-draggable" :list="item.list" :group="{ name: 'componentsGroup', pull: 'clone', put: false }" :clone="cloneComponent" draggable=".components-item" :sort="false" @end="onEnd">
      <div v-for="(element, index) in item.list" :key="Math.random()" class="components-item" @click="addComponent(element)">
        <div class="components-body">
          <svg-icon :icon-class="element.__config__.tagIcon" />
          {{ element.__config__.label }}
        </div>
      </div>
    </draggable>
  </div>

onEnd function do not executed