I'm trying to upload several files in one v-file input, but then have them stored each in v-file-input. But they stay as uploaded - in one v-file-input all.
part of my component-
<v-file-input
dense
single-line
multiple
:value="file"
@change="$emit('changeFile', $event)"
/>
changeFile handler
changeFile(obj, index, value) {
if (!Array.isArray(value)) {
obj[index].file = value;
} else {
let i = index,
newArr = [];
if (index < obj.length && obj.length != 1) {
newArr = obj.slice(index + 1, obj.length + 1);
obj.splice(index + 1);
}
value.forEach((it) => {
if (i + 1 == obj.length) {
obj[i].file = it;
} else {
obj.push({
file: it,
selectedItem: "install-workflow",
Hash: new Date().getTime(),
});
}
i++;
});
if (newArr.length > 0) {
obj = [...newArr];
}
}
this.WMSdef = obj;
},
the idea of file handling is that user can add several files to any place in the array and we must shift elements in it not to lose them.
component is used like this
<vue-file-and-box
v-for="(item, index) in WMSdef"
:key="item.Hash"
:items="Phases"
:text="item.file"
:value="item.selectedItem"
@change="changePhase(WMSdef, index, ...arguments)"
@changeFile="changeFile(WMSdef, index, ...arguments)"
@clickAdd="addFile(WMSdef)"
@clickDelete="deleteFile(WMSdef, 'WMS', item)"
/>
and in vue dev tools I see that WMSdef as an array is stored correct - it's an array of n files and so it should be shown with v-for as an array of my components. but I get one vue-file-and-box with n files and n-1 empty vue-file-and-box components this is how it looks