basic pdf viewer

This commit is contained in:
polv committed 2026-03-25 23:39:08 +07:00
1 parent 0a72f02f0b
commit 32ae81cb20
10 files changed
+186 -34

No files matched your search

@@ -1,30 +0,0 @@
<template>
<div :class="$style.container">
<iframe
:class="$style.iframe"
:src="src"
frameborder="0"
width="100%"
height="100%"
></iframe>
</div>
</template>
<script setup lang="ts">
defineProps<{ src: string }>();
</script>
<style module>
.container {
padding-bottom: 120%;
position: relative;
}
.iframe {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
}
</style>
+22
View File
@@ -0,0 +1,22 @@
<template>
<div :class="$style.container">
<VuePdf v-for="page in pages" :key="page" :pdf="pdf" :page="page" />
</div>
</template>
<script setup lang="ts">
const props = defineProps<{ src: string }>();
import { VuePdf, usePDF } from "@vue3-office/vue-pdf";
import "@vue3-office/vue-pdf/style.css";
const { pdf, pages, info } = usePDF(props.src);
</script>
<style module>
.container {
width: 100%;
max-height: 80vh;
overflow: scroll;
}
</style>
+2 -2
View File
@@ -7,7 +7,7 @@ import { h } from "vue";
import AudioButton from "./components/AudioButton.vue";
import Details from "./components/Details.vue";
import Frame from "./components/Frame.vue";
import PDF from "./components/PDF.vue";
import TTS from "./components/TTS.vue";
import YouTube from "./components/YouTube.vue";
@@ -26,6 +26,6 @@ export default {
app.component("Details", Details);
app.component("TTS", TTS);
app.component("YouTube", YouTube);
app.component("Frame", Frame);
app.component("PDF", PDF);
},
} satisfies Theme;