generated from Flycro/laravel-nuxt
feat: Add Preview for Local Files
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
999bd8e3d4
commit
ecc98924e3
|
|
@ -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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -123,6 +130,9 @@ async function onSubmit() {
|
||||||
<UFormGroup label="Beschreibung" name="description">
|
<UFormGroup label="Beschreibung" name="description">
|
||||||
<UTextarea v-model="state.description" />
|
<UTextarea v-model="state.description" />
|
||||||
</UFormGroup>
|
</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">
|
<UFormGroup label="Cover" name="cover_image">
|
||||||
<UInput type="file" @change="handleCoverImageInput" />
|
<UInput type="file" @change="handleCoverImageInput" />
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue