Closed AHRL closed 3 years ago
code like this:
computed: {
value: {
get() {
return this.model.map((i) => ({ id: i }));
},
set(val) {
this.model = val.map((i) => i.id );
},
},
},
so you can do :
<draggable
v-if="model && model.length"
v-model="value"
item-key="id"
>
<template #item="{ element, index }">
{{ element.id }}
</template>
</draggable>
thanks~
model = ['111', '222'] or [{ a: '111', b: '222' }]
because value is uncertain in model, so i want to use array subscripts as itemKey. please help me ~