fix: Preview for local Files
continuous-integration/drone/push Build is passing Details

main
Flycro 2024-03-21 12:25:08 +01:00
parent ac371e4451
commit 1297ba88c5
1 changed files with 5 additions and 1 deletions

View File

@ -114,6 +114,10 @@ async function onSubmit(event: FormSubmitEvent<any>) {
})
await bookRecommendationStore.fetchRecommendations()
}
function isFile(value: any): value is File {
return value instanceof File
}
</script>
<template>
@ -145,7 +149,7 @@ async function onSubmit(event: FormSubmitEvent<any>) {
<UTextarea v-model="state.description" />
</UFormGroup>
<img v-if="state.cover_image && typeof state.cover_image === 'string'" :src="$storage(state.cover_image)" alt="Cover" class="size-1/3 content-center rounded-lg">
<img v-else-if="state.cover_image && state.cover_image instanceof File" :src="URL.createObjectURL(state.cover_image)" alt="Cover" class="size-1/3 content-center rounded-lg">
<img v-else-if="state.cover_image && isFile(state.cover_image)" :src="URL.createObjectURL(state.cover_image)" alt="Cover" class="size-1/3 content-center rounded-lg">
<UFormGroup label="Cover" name="cover_image">
<UInput type="file" @change="handleCoverImageInput" />
</UFormGroup>