This commit is contained in:
syuilo 2025-09-23 19:21:19 +09:00
parent 4e0ffebcd4
commit 330f124bf6
2 changed files with 9 additions and 2 deletions

View File

@ -219,7 +219,7 @@ const uploader = useUploader({
}); });
onUnmounted(() => { onUnmounted(() => {
uploader.abortAll(); uploader.dispose();
}); });
uploader.events.on('itemUploaded', ctx => { uploader.events.on('itemUploaded', ctx => {

View File

@ -663,10 +663,16 @@ export function useUploader(options: {
item.preprocessedFile = markRaw(preprocessedFile); item.preprocessedFile = markRaw(preprocessedFile);
} }
onUnmounted(() => { function dispose() {
for (const item of items.value) { for (const item of items.value) {
if (item.thumbnail != null) URL.revokeObjectURL(item.thumbnail); if (item.thumbnail != null) URL.revokeObjectURL(item.thumbnail);
} }
abortAll();
}
onUnmounted(() => {
dispose();
}); });
return { return {
@ -674,6 +680,7 @@ export function useUploader(options: {
addFiles, addFiles,
removeItem, removeItem,
abortAll, abortAll,
dispose,
upload, upload,
getMenu, getMenu,
uploading: computed(() => items.value.some(item => item.uploading)), uploading: computed(() => items.value.some(item => item.uploading)),