mirror of
https://github.com/directus/directus.git
synced 2026-01-26 23:19:15 -05:00
Support selecting multiple files in v-upload (#17394)
* support multiple on selection in v-upload * run linter
This commit is contained in:
@@ -235,12 +235,26 @@ function useSelection() {
|
||||
return { setSelection };
|
||||
|
||||
async function setSelection(selection: string[]) {
|
||||
if (selection[0]) {
|
||||
const id = selection[0];
|
||||
const fileResponse = await api.get(`/files/${id}`);
|
||||
emit('input', fileResponse.data.data);
|
||||
if (props.multiple) {
|
||||
const filesResponse = await api.get(`/files`, {
|
||||
params: {
|
||||
filter: {
|
||||
id: {
|
||||
_in: selection,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
emit('input', filesResponse.data.data);
|
||||
} else {
|
||||
emit('input', null);
|
||||
if (selection[0]) {
|
||||
const id = selection[0];
|
||||
const fileResponse = await api.get(`/files/${id}`);
|
||||
emit('input', fileResponse.data.data);
|
||||
} else {
|
||||
emit('input', null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user