generated from Flycro/laravel-nuxt
Compare commits
2 Commits
78e3f0ff0c
...
ecc98924e3
| Author | SHA1 | Date |
|---|---|---|
|
|
ecc98924e3 | |
|
|
999bd8e3d4 |
|
|
@ -155,7 +155,7 @@ function getFileUrl(file: File) {
|
|||
<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">
|
||||
<ClientOnly>
|
||||
<img v-if="state.cover_image && isFile(state.cover_image)" :src="getFileUrl(state.cover_image)" alt="Cover" class="size-1/3 content-center rounded-lg">
|
||||
</ClientOnly>>
|
||||
</ClientOnly>
|
||||
<UFormGroup label="Cover" name="cover_image">
|
||||
<UInput type="file" @change="handleCoverImageInput" />
|
||||
</UFormGroup>
|
||||
|
|
|
|||
|
|
@ -91,6 +91,13 @@ async function onSubmit() {
|
|||
},
|
||||
})
|
||||
}
|
||||
function isFile(value: any): value is File {
|
||||
return value instanceof File
|
||||
}
|
||||
|
||||
function getFileUrl(file: File) {
|
||||
return URL.createObjectURL(file)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -123,6 +130,9 @@ async function onSubmit() {
|
|||
<UFormGroup label="Beschreibung" name="description">
|
||||
<UTextarea v-model="state.description" />
|
||||
</UFormGroup>
|
||||
<ClientOnly>
|
||||
<img v-if="state.cover_image && isFile(state.cover_image)" :src="getFileUrl(state.cover_image)" alt="Cover" class="size-1/3 content-center rounded-lg">
|
||||
</ClientOnly>
|
||||
<UFormGroup label="Cover" name="cover_image">
|
||||
<UInput type="file" @change="handleCoverImageInput" />
|
||||
</UFormGroup>
|
||||
|
|
|
|||
Loading…
Reference in New Issue