1、Error: draggable element must have an item slot
升级组件
npm i -S vuedraggable@next
使用示例
<div class="col-3">
<h3>Draggable 1</h3>
<draggable
class="list-group"
:list="list1"
group="people"
@change="log"
itemKey="name"
>
<template #item="{ element, index }">
<div>{{ element.name }} {{ index }}</div>
</template>
</draggable>
</div>
<div class="col-3">
<h3>Draggable 2</h3>
<draggable
class="list-group"
:list="list2"
group="people"
@change="log"
itemKey="name"
>
<template #item="{ element, index }">
<div class="list-group-item">{{ element.name }} {{ index }}</div>
</template>
</draggable>
</div>
const list1 = ref([
{ name: "John", id: 1 },
{ name: "Joao", id: 2 },
{ name: "Jean", id: 3 },
{ name: "Gerard", id: 4 }
])
const list2 = ref([
{ name: "Juan", id: 5 },
{ name: "Edgard", id: 6 },
{ name: "Johnson", id: 7 }
])
2、Item slot must have only one child
官方GitHub - SortableJS/vue.draggable.next: Vue 3 compatible drag-and-drop component based on Sortable.js
官方demo
版权归原作者 码住不放松 所有, 如有侵权,请联系我们删除。