diff --git a/playground/app/pages/components/file-upload.vue b/playground/app/pages/components/file-upload.vue index e6b0002b..9b37751b 100644 --- a/playground/app/pages/components/file-upload.vue +++ b/playground/app/pages/components/file-upload.vue @@ -64,6 +64,10 @@ const state = reactive>({ const upload = useUpload('/api/blob', { method: 'PUT' }) +function createObjectUrl(file: File): string { + return URL.createObjectURL(file) +} + async function onSubmit(event: FormSubmitEvent) { const res = await upload(event.data.avatar) @@ -79,9 +83,9 @@ async function onSubmit(event: FormSubmitEvent) { - +
- +
@@ -107,11 +111,8 @@ async function onSubmit(event: FormSubmitEvent) { - - diff --git a/src/runtime/components/FileUpload.vue b/src/runtime/components/FileUpload.vue index 143a899d..2fcf82f2 100644 --- a/src/runtime/components/FileUpload.vue +++ b/src/runtime/components/FileUpload.vue @@ -81,7 +81,9 @@ import { useAppConfig } from '#imports' import { useFormField } from '../composables/useFormField' import { useFileUpload } from '../composables/useFileUpload' import { tv } from '../utils/tv' +import UAvatar from './Avatar.vue' import UButton from './Button.vue' +import UIcon from './Icon.vue' defineOptions({ inheritAttrs: false }) @@ -164,7 +166,7 @@ defineExpose({
- +
@@ -187,11 +189,13 @@ defineExpose({
-
+
-
+
- {{ file.name }} + + {{ (file as File).name }} +