File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
panel/src/components/Collection Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 3131 @change =" $emit('change', $event)"
3232 @end =" $emit('sort', items, $event)"
3333 >
34- <template v-for =" (item , itemIndex ) in items " >
34+ <template v-for =" (item , itemIndex ) in itemsWithIds " >
3535 <slot v-bind =" { item, itemIndex }" >
3636 <k-item
37- :key =" item.id ?? itemIndex "
37+ :key =" item.id"
3838 v-bind =" item"
3939 :class =" { 'k-draggable-item': sortable && item.sortable }"
4040 :image =" imageOptions(item)"
@@ -143,6 +143,16 @@ export default {
143143 draggable: " .k-draggable-item"
144144 };
145145 },
146+ /**
147+ * Adds a unique id to each item if it doesn't have one
148+ * to be used for `:key` in the `v-for` loop
149+ */
150+ itemsWithIds () {
151+ return this .items .map ((item ) => ({
152+ ... item,
153+ id: item .id ?? item .uuid ?? this .$helper .uuid ()
154+ }));
155+ },
146156 table () {
147157 return {
148158 columns: this .columns ,
You can’t perform that action at this time.
0 commit comments