From 8296816e95bc4c4cba378d2e4bc4d0e1d2d14f90 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期一, 08 七月 2024 09:43:07 +0800 Subject: [PATCH] 发版环境 --- src/components/PDFViewer/index.vue | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/src/components/PDFViewer/index.vue b/src/components/PDFViewer/index.vue new file mode 100644 index 0000000..bb10852 --- /dev/null +++ b/src/components/PDFViewer/index.vue @@ -0,0 +1,41 @@ +<template> + <div class="pdf-container"> + <iframe :src="fileUrl" width="100%" height="100%"></iframe> + </div> +</template> + +<script setup> +import { ref, onMounted } from 'vue'; + +const props = defineProps({ + pdfUrl: { + type: String, + required: true + } +}); +const viewerUrl = '/pdfjs/web/viewer.html?file='; // pdfjs鏂囦欢鍦板潃 + +const fileUrl = ref(''); + + +const renderPDF = () => { + fileUrl.value = viewerUrl + encodeURIComponent(props.pdfUrl); +}; + +onMounted(() => { + renderPDF(); +}) + +</script> + +<style lang="scss" scoped> +.pdf-container { + width: 100%; + height: 100%; + + .pdf-canvas { + width: 100%; + height: 100%; + } +} +</style> \ No newline at end of file -- Gitblit v1.8.0