You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/SortableJS/Vue.Draggable/issues?q=is%3Aopen+is%3Aissue)
7
+
[](https://github.com/SortableJS/Vue.Draggable/issues?q=is%3Aopen+is%3Aissue)
@@ -166,12 +214,18 @@ Alternative to the `modelValue` prop, list is an array to be synchronized with d
166
214
The main difference is that `list` prop is updated by draggable component using splice method, whereas `modelValue` is immutable.<br>
167
215
**Do not use in conjunction with modelValue prop.**
168
216
217
+
#### itemKey
218
+
Type: `String` or `Function`<br>
219
+
Required: `true`<br>
220
+
221
+
The property to be used as the element key. Alternatively a function receiving an element of the list and returning its key.
222
+
169
223
#### All sortable options
170
224
Sortable options can be set directly as vue.draggable props since version 2.19.
171
225
172
226
This means that all [sortable option](https://github.com/RubaXa/Sortable#options) are valid sortable props with the notable exception of all the method starting by "on" as draggable component expose the same API via events.
173
227
174
-
kebab-case propery are supported: for example `ghost-class` props will be converted to `ghostClass` sortable option.
228
+
kebab-case property are supported: for example `ghost-class` props will be converted to `ghostClass` sortable option.
175
229
176
230
Example setting handle, sortable and a group option:
177
231
```HTML
@@ -309,7 +363,23 @@ HTML:
309
363
310
364
### Slots
311
365
312
-
Limitation: neither header or footer slot works in conjunction with transition-group.
366
+
#### item
367
+
The `item` slot is used to display one element of the list. Vue.draggable will iterate the list and call this slot for each element.
368
+
369
+
Slot props:
370
+
- `element` the element in the list
371
+
- `index` the element index
372
+
373
+
It is the only required slot.
374
+
375
+
376
+
```html
377
+
<draggable v-model="myArray" item-key="id">
378
+
<template #item="{element, index}">
379
+
<div> {{index}} - {{element.name}} </div>
380
+
</template>
381
+
</draggable>
382
+
```
313
383
314
384
#### Header
315
385
Use the `header` slot to add none-draggable element inside the vuedraggable component.
0 commit comments