refactor: Array.from(iterable).map(mapfn)をArray.from(iterable | { length: number }, mapfn)に (#11337)

* refactor: Array.from(iterable).map(mapfn)をArray.from(iterable, mapfn)に

* Update packages/frontend/src/components/MkTagCloud.vue

Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>

---------

Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
This commit is contained in:
tamaina
2023-07-25 19:46:52 +09:00
committed by GitHub
parent 9208cfd5f3
commit fe13755be8
4 changed files with 7 additions and 6 deletions

View File

@@ -12,7 +12,8 @@ export function chooseFileFromPc(multiple: boolean, keepOriginal = false): Promi
input.type = 'file';
input.multiple = multiple;
input.onchange = () => {
const promises = Array.from(input.files).map(file => uploadFile(file, defaultStore.state.uploadFolder, undefined, keepOriginal));
if (!input.files) return res([]);
const promises = Array.from(input.files, file => uploadFile(file, defaultStore.state.uploadFolder, undefined, keepOriginal));
Promise.all(promises).then(driveFiles => {
res(driveFiles);