From e1b028d486713eaf55aaf35fbf334aa568059c0d Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期二, 14 四月 2026 15:46:54 +0800
Subject: [PATCH] 项目复制
---
src/views/components/PdfPreview.vue | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/src/views/components/PdfPreview.vue b/src/views/components/PdfPreview.vue
new file mode 100644
index 0000000..97e23ba
--- /dev/null
+++ b/src/views/components/PdfPreview.vue
@@ -0,0 +1,50 @@
+<script setup lang="ts">
+import Pdfh5 from "pdfh5"
+import { ref, onMounted, onUnmounted } from 'vue'
+
+const container = ref<HTMLElement>()
+let pdfViewer: any = null
+
+const props = defineProps({
+ url: {
+ type: String,
+ required: true
+ }
+})
+
+onMounted(async () => {
+ try {
+ // 鍒涘缓PDF鏌ョ湅鍣�
+ pdfViewer = new Pdfh5(container.value!, {
+ pdfurl: props.url,
+ textLayer: true,
+ workerSrc: '/examination/admin/pdf.worker.min.js',
+ cMapUrl: '/examination/admin/cmaps/',
+ standardFontDataUrl: '/examination/admin/standard_fonts/',
+ iccUrl: '/examination/admin/iccs/',
+ wasmUrl: '/examination/admin/wasm/'
+ });
+ const appElement = document.getElementById('app')
+
+ } catch (error) {
+ console.error('PDF鍒濆鍖栧け璐�:', error);
+ }
+})
+
+onUnmounted(() => {
+ if (pdfViewer && typeof pdfViewer.destroy === 'function') {
+ pdfViewer.destroy()
+ }
+})
+</script>
+
+<template>
+ <div class="pdf-container" ref="container"></div>
+</template>
+
+<style scoped>
+.pdf-container {
+ width: 100%;
+ height: 100%;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.8.0